PSPでのstrcpy_sについて
Posted: 2011年6月18日(土) 23:11
お世話になります。
現在Windowsで作成したSTGをPSPに移植させている途中
各ステージでの会話(サウンドノベル)部分でエラーが出てしまい色々と自分で調べて見たのですが
解決になりそうに無いので投稿させていただきました。
以下のソースをビルドすると次のようなエラーが出ます。
1>fantasy.cpp:75: error: 'strcpy_s' was not declared in this scope
Windowsではこのようなエラーは出ないのですが
PSPでは出てしまいます。
string.hはインクルードしてあり問題の箇所が分からない状況です。
(ソースコードは龍神録の支館様の「サウンドノベル実装」のソースを一部改変して使用させてもらっています。)
以下はビルド環境です。
Windows7 Visual Studio 2008
Minimalist PSP homebrew SDK for Windows v0.11.1
使用ライブラリ DXライブラリPortable v0.5.7 UTF-8版
現在Windowsで作成したSTGをPSPに移植させている途中
各ステージでの会話(サウンドノベル)部分でエラーが出てしまい色々と自分で調べて見たのですが
解決になりそうに無いので投稿させていただきました。
以下のソースをビルドすると次のようなエラーが出ます。
1>fantasy.cpp:75: error: 'strcpy_s' was not declared in this scope
Windowsではこのようなエラーは出ないのですが
PSPでは出てしまいます。
string.hはインクルードしてあり問題の箇所が分からない状況です。
(ソースコードは龍神録の支館様の「サウンドノベル実装」のソースを一部改変して使用させてもらっています。)
#include "GV.h"
//ストーリーデータの読み込み
void fantasy_load(const char *file_name)
{
int i, n, s; // カウンタ
int num = 0; // カウンタ
int fp; // ファイルポインタ
char buffer[256]; // 文字バッファ
char token[10][256]; // 文字バッファ
// ファイルオープン
if( ( fp = FileRead_open( file_name ) ) == NULL ) {
// エラー処理
}
// ファイル終端まで読み込む
while(FileRead_eof(fp) == 0 && num < 49) {
// 1行読み込む
if( FileRead_gets( buffer, 256, fp ) == -1 )
continue;
// 先頭文字が「/」ならスキップ
if( buffer[0] == '/' )
continue;
// CSV形式ファイル分割
n = 0; s = 0;
for(i = 0; i < 256; i++) {
if( buffer[i] == ',' ) {
token[n][s] = '\0';
s = 0;
n++;
continue;
}
if( buffer[i] == '\0' ) {
token[n][s] = '\0';
n++;
break;
}
token[n][s] = buffer[i];
s++;
}
// 種類
story[num].type = atoi(token[0]);
// 名前
strcpy_s(story[num].name, 50, token[1]);
// 表情
story[num].look = atoi( token[2] );
// 本文
strcpy_s(story[num].story, 256, token[3]);
//改行本文
strcpy_s(story[num].story2, 256, token[4]);
num++;
}
story[num].story[0] = '\0';
FileRead_close(fp);
}
void fantasy_disp()
{
static int num;
static int len;
char buf[256];
char buf2[256];
static int storyccount = 0;
strcpy_s(buf, 256, story[num].story);
strcpy_s(buf2, 256 , story[num].story2);
if(CheckStatePad(configpad.shot) == 1) {
if( buf[len] == '\0' )
{
len = 0;
++num;
}
}
if(CheckStatePad(configpad.bom)%5 == 4) {
len = 0;
++num;
}
// 本文が無かったら終了
if(buf[0] == '\0') {
num = 0;
len = 0;
kks.fantasy = 0;
func_state = 100;
return;
}
for(int i = 0; i < 2 && buf[len] || buf2[len] != '\0'; ++i) {
switch( buf[len] ) {
case '\0':
break;
default:
++len;
break;
}
switch( buf2[len] ) {
case '\0':
break;
default:
++len;
break;
}
}
buf[len] = '\0';
buf2[len] = '\0';
/* ▼ ラノベ描画 */
//主人公関係の処理
if(story[num].type == 1){
storyccount++;
if(storyccount <= 127){
DrawGraph(FX , FY +100, syuzin1,TRUE);}
else if (storyccount >=128 && storyccount<=130){
DrawGraph(FX , FY +100, syuzin2,TRUE);}
else if (storyccount >=131 && storyccount<=133){
DrawGraph(FX , FY +100, syuzin3,TRUE);}
else if (storyccount >= 134 && storyccount<= 136){
DrawGraph(FX , FY +100, syuzin4,TRUE);}
else if (storyccount ==137){
DrawGraph(FX , FY +100, syuzin4,TRUE);
storyccount =0;}
}
//if(story[num].type == 101){
//DrawGraph(FX+194,FY+120,tekiganzin,TRUE);}
//↑ここまで
//if(story[num].type == 2){
//DrawGraph(FX +194 , FY + 150, teki1[0],TRUE);}
DrawGraph(FX-15 , FMY - 75,img_kaiwa,TRUE);
// 名前
if(story[num].look == 0){
DrawFormatStringToHandle(FX + 5, FMY - 42, color[5] , font[0], story[num].name);}
if(story[num].look == 1){
DrawFormatStringToHandle(FMX - 90, FMY - 42, color[5] , font[0], story[num].name);}
// 本文
DrawFormatStringToHandle(FX + 15 , FMY - 23, color[5] , font[0], buf);
//改行本文
DrawFormatStringToHandle(FX + 15 , FMY - 8, color[5] , font[0], buf2);
}
//サウンドノベル割り込み判断
void fantasy_check()
{
//ステージカウント9の時に指定のファイルを読み込みサウンドノベル処理へ
if(stage_count == 2379 && kks.stage == 1) {
kks.fantasy = 1;//カウント9
fantasy_load( "../dat/story/story0.csv" ); //指定のファイル(プロジェクトと同じ階層)
func_state = 103; //サウンドノベル処理へ
}
if(stage_count == 1649 && kks.stage == 101) { //カウント1649で鑑真襲来のmisson時
kks.fantasy = 1;
fantasy_load( "../dat/story/story099-1.csv" ); //指定のファイル(プロジェクトと同じ階層)
func_state = 103; //サウンドノベル処理へ
}
if(stage_count == 3699 && kks.stage == 1) { //カウント9
kks.fantasy = 1;
fantasy_load( "../dat/story/story0-1.csv" ); //指定のファイル(プロジェクトと同じ階層)
func_state = 103; //サウンドノベル処理へ
}
if(stage_count == 2849 && kks.stage == 101) { //カウント2849で鑑真襲来のmisson時
kks.fantasy = 1;
fantasy_load( "../dat/story/story099.csv" ); //指定のファイル(プロジェクトと同じ階層)
func_state = 103; //サウンドノベル処理へ
}
if(stage_count == 3650 && kks.stage == 1) { //カウント9
kks.fantasy = 1;
fantasy_load( "../dat/story/story0-2.csv" ); //指定のファイル(プロジェクトと同じ階層)
func_state = 103; //サウンドノベル処理へ
}if(stage_count == 3800){
func_state = 1;}
/* if(stage_count == 3000){
delete_bgm();
save();
DrawGraph( 0 , 0 , gameover[0] , TRUE );
ScreenFlip();
WaitKey() ;
kks.menuflag = 0;
kks.flagfeel = 0;
fedoout();
func_state=2;}
storyc.count++;*/
} Windows7 Visual Studio 2008
Minimalist PSP homebrew SDK for Windows v0.11.1
使用ライブラリ DXライブラリPortable v0.5.7 UTF-8版