Revert more unnecessary edits
This commit is contained in:
parent
2970242ff7
commit
27a1fd900f
21 changed files with 144 additions and 55 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -25,7 +26,9 @@ BOOL InitBack(const char *fName, int type)
|
||||||
color_black = GetCortBoxColor(RGB(0, 0, 0x10));
|
color_black = GetCortBoxColor(RGB(0, 0, 0x10));
|
||||||
|
|
||||||
// Get width and height
|
// Get width and height
|
||||||
FILE *fp = fopen((gDataPath + '/' + fName + ".pbm").c_str(), "rb");
|
std::string path = gDataPath + '/' + fName + ".pbm";
|
||||||
|
|
||||||
|
FILE *fp = fopen(path.c_str(), "rb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../Attributes.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "../Attributes.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
// Based on US QWERTY
|
// Based on US QWERTY
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "../Misc.h"
|
#include "../Misc.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
bool Backend_Init(void)
|
bool Backend_Init(void)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <coreinit/thread.h>
|
#include <coreinit/thread.h>
|
||||||
#include <padscore/kpad.h>
|
#include <padscore/kpad.h>
|
||||||
|
@ -57,10 +58,11 @@ void Backend_PostWindowCreation(void)
|
||||||
bool Backend_GetBasePath(std::string *string_buffer)
|
bool Backend_GetBasePath(std::string *string_buffer)
|
||||||
{
|
{
|
||||||
#ifdef JAPANESE
|
#ifdef JAPANESE
|
||||||
*string_buffer = std::string{WHBGetSdCardMountPath()} + "/CSE-portable-jp";
|
*string_buffer = std::string{WHBGetSdCardMountPath()} + "/CSE2-portable-jp";
|
||||||
#else
|
#else
|
||||||
*string_buffer = std::string{WHBGetSdCardMountPath()} + "/CSE-portable-en";
|
*string_buffer = std::string{WHBGetSdCardMountPath()} + "/CSE2-portable-en";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -17,7 +18,9 @@ BOOL LoadConfigData(CONFIG *conf)
|
||||||
memset(conf, 0, sizeof(CONFIG));
|
memset(conf, 0, sizeof(CONFIG));
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
FILE *fp = fopen((gModulePath + '/' + gConfigName).c_str(), "rb");
|
std::string path = gModulePath + '/' + gConfigName;
|
||||||
|
|
||||||
|
FILE *fp = fopen(path.c_str(), "rb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
10
src/Draw.cpp
10
src/Draw.cpp
|
@ -4,6 +4,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -250,7 +251,7 @@ BOOL MakeSurface_Resource(const char *name, SurfaceID surf_no)
|
||||||
// TODO - Inaccurate stack frame
|
// TODO - Inaccurate stack frame
|
||||||
BOOL MakeSurface_File(const char *name, SurfaceID surf_no)
|
BOOL MakeSurface_File(const char *name, SurfaceID surf_no)
|
||||||
{
|
{
|
||||||
auto path = gDataPath + '/' + name + ".pbm";
|
std::string path = gDataPath + '/' + name + ".pbm";
|
||||||
|
|
||||||
if (!IsEnableBitmap(path.c_str()))
|
if (!IsEnableBitmap(path.c_str()))
|
||||||
{
|
{
|
||||||
|
@ -340,7 +341,7 @@ BOOL ReloadBitmap_Resource(const char *name, SurfaceID surf_no)
|
||||||
// TODO - Inaccurate stack frame
|
// TODO - Inaccurate stack frame
|
||||||
BOOL ReloadBitmap_File(const char *name, SurfaceID surf_no)
|
BOOL ReloadBitmap_File(const char *name, SurfaceID surf_no)
|
||||||
{
|
{
|
||||||
auto path = gDataPath + '/' + name + ".pbm";
|
std::string path = gDataPath + '/' + name + ".pbm";
|
||||||
|
|
||||||
if (!IsEnableBitmap(path.c_str()))
|
if (!IsEnableBitmap(path.c_str()))
|
||||||
{
|
{
|
||||||
|
@ -376,6 +377,7 @@ BOOL ReloadBitmap_File(const char *name, SurfaceID surf_no)
|
||||||
FreeBitmap(image_buffer);
|
FreeBitmap(image_buffer);
|
||||||
surface_metadata[surf_no].type = SURFACE_SOURCE_FILE;
|
surface_metadata[surf_no].type = SURFACE_SOURCE_FILE;
|
||||||
strcpy(surface_metadata[surf_no].name, name);
|
strcpy(surface_metadata[surf_no].name, name);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,6 +646,8 @@ void InitTextObject(const char *name)
|
||||||
{
|
{
|
||||||
(void)name; // Unused in this branch
|
(void)name; // Unused in this branch
|
||||||
|
|
||||||
|
std::string path = gDataPath + "/Font/font";
|
||||||
|
|
||||||
// Get font size
|
// Get font size
|
||||||
unsigned int width, height;
|
unsigned int width, height;
|
||||||
|
|
||||||
|
@ -660,7 +664,7 @@ void InitTextObject(const char *name)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
font = LoadFont((gDataPath + "/Font/font").c_str(), width, height);
|
font = LoadFont(path.c_str(), width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PutText(int x, int y, const char *text, unsigned long color)
|
void PutText(int x, int y, const char *text, unsigned long color)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -216,6 +217,7 @@ void ReleaseCreditScript(void)
|
||||||
BOOL StartCreditScript(void)
|
BOOL StartCreditScript(void)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
std::string path;
|
||||||
|
|
||||||
// Clear previously existing credits data
|
// Clear previously existing credits data
|
||||||
if (Credit.pData != NULL)
|
if (Credit.pData != NULL)
|
||||||
|
@ -225,7 +227,8 @@ BOOL StartCreditScript(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
auto path = gDataPath + '/' + credit_script;
|
path = gDataPath + '/' + credit_script;
|
||||||
|
|
||||||
Credit.size = GetFileSizeLong(path.c_str());
|
Credit.size = GetFileSizeLong(path.c_str());
|
||||||
if (Credit.size == -1)
|
if (Credit.size == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -701,7 +702,9 @@ BOOL Game(void)
|
||||||
|
|
||||||
PlaySoundObject(7, -1);
|
PlaySoundObject(7, -1);
|
||||||
|
|
||||||
if (!LoadNpcTable((gDataPath + "/npc.tbl").c_str()))
|
std::string path = gDataPath + "/npc.tbl";
|
||||||
|
|
||||||
|
if (!LoadNpcTable(path.c_str()))
|
||||||
{
|
{
|
||||||
#ifdef JAPANESE
|
#ifdef JAPANESE
|
||||||
Backend_ShowMessageBox("エラー", "NPCテーブルが読めない");
|
Backend_ShowMessageBox("エラー", "NPCテーブルが読めない");
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -49,12 +50,18 @@ BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
|
||||||
|
|
||||||
void DeleteLog(void)
|
void DeleteLog(void)
|
||||||
{
|
{
|
||||||
remove((gModulePath + "/debug.txt").c_str());
|
std::string path = gModulePath + "/debug.txt";
|
||||||
|
remove(path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WriteLog(const char *string, int value1, int value2, int value3)
|
BOOL WriteLog(const char *string, int value1, int value2, int value3)
|
||||||
{
|
{
|
||||||
FILE *fp = fopen((gModulePath + "/debug.txt").c_str(), "a+");
|
std::string path;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
path = gModulePath + "/debug.txt";
|
||||||
|
fp = fopen(path.c_str(), "a+");
|
||||||
|
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -65,7 +72,10 @@ BOOL WriteLog(const char *string, int value1, int value2, int value3)
|
||||||
|
|
||||||
BOOL IsKeyFile(const char *name)
|
BOOL IsKeyFile(const char *name)
|
||||||
{
|
{
|
||||||
FILE *file = fopen((gModulePath + '/' + name).c_str(), "rb");
|
std::string path = gModulePath + '/' + name;
|
||||||
|
|
||||||
|
FILE *file = fopen(path.c_str(), "rb");
|
||||||
|
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -93,12 +103,15 @@ long GetFileSizeLong(const char *path)
|
||||||
|
|
||||||
BOOL ErrorLog(const char *string, int value)
|
BOOL ErrorLog(const char *string, int value)
|
||||||
{
|
{
|
||||||
auto path = gModulePath + "/error.log";
|
std::string path;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
path = gModulePath + "/error.log";
|
||||||
|
|
||||||
if (GetFileSizeLong(path.c_str()) > 0x19000) // Purge the error log if it gets too big, I guess
|
if (GetFileSizeLong(path.c_str()) > 0x19000) // Purge the error log if it gets too big, I guess
|
||||||
remove(path.c_str());
|
remove(path.c_str());
|
||||||
|
|
||||||
FILE *fp = fopen(path.c_str(), "a+");
|
fp = fopen(path.c_str(), "a+");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -293,10 +293,9 @@ BOOL LoadGenericData(void)
|
||||||
pt_size += MakePixToneObject(&gPtpTable[137], 1, 6);
|
pt_size += MakePixToneObject(&gPtpTable[137], 1, 6);
|
||||||
pt_size += MakePixToneObject(&gPtpTable[138], 1, 7);
|
pt_size += MakePixToneObject(&gPtpTable[138], 1, 7);
|
||||||
|
|
||||||
/*
|
// Commented-out, since ints *technically* have an undefined length
|
||||||
* char str[0x40];
|
// char str[0x40];
|
||||||
* sprintf(str, "PixTone = %d byte", pt_size);
|
// sprintf(str, "PixTone = %d byte", pt_size);
|
||||||
* // There must have been some kind of console print function here or something
|
// There must have been some kind of console print function here or something
|
||||||
*/
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -327,7 +328,7 @@ int main(int argc, char *argv[])
|
||||||
if (!Flip_SystemTask())
|
if (!Flip_SystemTask())
|
||||||
{
|
{
|
||||||
Backend_Deinit();
|
Backend_Deinit();
|
||||||
return EXIT_FAILURE;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize sound
|
// Initialize sound
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
extern std::string gModulePath;
|
extern std::string gModulePath;
|
||||||
extern std::string gDataPath;
|
extern std::string gDataPath;
|
||||||
|
|
||||||
|
|
15
src/Map.cpp
15
src/Map.cpp
|
@ -4,6 +4,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -27,10 +28,15 @@ BOOL InitMapData2(void)
|
||||||
|
|
||||||
BOOL LoadMapData2(const char *path_map)
|
BOOL LoadMapData2(const char *path_map)
|
||||||
{
|
{
|
||||||
|
FILE *fp;
|
||||||
char check[3];
|
char check[3];
|
||||||
|
std::string path;
|
||||||
|
|
||||||
|
// Get path
|
||||||
|
path = gDataPath + '/' + path_map;
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
FILE *fp = fopen((gDataPath + '/' + path_map).c_str(), "rb");
|
fp = fopen(path.c_str(), "rb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -63,8 +69,13 @@ BOOL LoadMapData2(const char *path_map)
|
||||||
|
|
||||||
BOOL LoadAttributeData(const char *path_atrb)
|
BOOL LoadAttributeData(const char *path_atrb)
|
||||||
{
|
{
|
||||||
|
FILE *fp;
|
||||||
|
std::string path;
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
FILE *fp = fopen((gDataPath + '/' + path_atrb).c_str(), "rb");
|
path = gDataPath + '/' + path_atrb;
|
||||||
|
|
||||||
|
fp = fopen(path.c_str(), "rb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "MycParam.h"
|
#include "MycParam.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -435,15 +436,17 @@ BOOL SaveTimeCounter(void)
|
||||||
int i;
|
int i;
|
||||||
unsigned char p[4];
|
unsigned char p[4];
|
||||||
REC rec;
|
REC rec;
|
||||||
|
FILE *fp;
|
||||||
|
std::string path;
|
||||||
|
|
||||||
// Quit if player doesn't have the Nikumaru Counter
|
// Quit if player doesn't have the Nikumaru Counter
|
||||||
if (!(gMC.equip & EQUIP_NIKUMARU_COUNTER))
|
if (!(gMC.equip & EQUIP_NIKUMARU_COUNTER))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
// Get last time
|
// Get last time
|
||||||
auto path = gModulePath + "/290.rec";
|
path = gModulePath + "/290.rec";
|
||||||
|
|
||||||
FILE *fp = fopen(path.c_str(), "rb");
|
fp = fopen(path.c_str(), "rb");
|
||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
{
|
{
|
||||||
// Read data
|
// Read data
|
||||||
|
@ -505,9 +508,13 @@ int LoadTimeCounter(void)
|
||||||
int i;
|
int i;
|
||||||
unsigned char p[4];
|
unsigned char p[4];
|
||||||
REC rec;
|
REC rec;
|
||||||
|
FILE *fp;
|
||||||
|
std::string path;
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
FILE *fp = fopen((gModulePath + "/290.rec").c_str(), "rb");
|
path = gModulePath + "/290.rec";
|
||||||
|
|
||||||
|
fp = fopen(path.c_str(), "rb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -54,11 +55,14 @@ void InitNpChar(void)
|
||||||
BOOL LoadEvent(const char *path_event)
|
BOOL LoadEvent(const char *path_event)
|
||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
|
FILE *fp;
|
||||||
int count;
|
int count;
|
||||||
char code[4];
|
char code[4];
|
||||||
EVENT eve;
|
EVENT eve;
|
||||||
|
|
||||||
FILE *fp = fopen((gDataPath + '/' + path_event).c_str(), "rb");
|
std::string path = gDataPath + '/' + path_event;
|
||||||
|
|
||||||
|
fp = fopen(path.c_str(), "rb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -28,7 +29,9 @@ const char* const gProfileCode = "Do041220";
|
||||||
|
|
||||||
BOOL IsProfile(void)
|
BOOL IsProfile(void)
|
||||||
{
|
{
|
||||||
FILE *file = fopen((gModulePath + '/' + gDefaultName).c_str(), "rb");
|
std::string path = gModulePath + '/' + gDefaultName;
|
||||||
|
|
||||||
|
FILE *file = fopen(path.c_str(), "rb");
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -38,15 +41,24 @@ BOOL IsProfile(void)
|
||||||
|
|
||||||
BOOL SaveProfile(const char *name)
|
BOOL SaveProfile(const char *name)
|
||||||
{
|
{
|
||||||
|
FILE *fp;
|
||||||
|
PROFILE profile;
|
||||||
const char *FLAG = "FLAG";
|
const char *FLAG = "FLAG";
|
||||||
|
|
||||||
|
std::string path;
|
||||||
|
|
||||||
|
// Get path
|
||||||
|
if (name != NULL)
|
||||||
|
path = gModulePath + '/' + name;
|
||||||
|
else
|
||||||
|
path = gModulePath + '/' + gDefaultName;
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
FILE *fp = fopen((gModulePath + '/' + ((name != NULL) ? name : gDefaultName)).c_str(), "wb");
|
fp = fopen(path.c_str(), "wb");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Set up profile
|
// Set up profile
|
||||||
PROFILE profile;
|
|
||||||
memset(&profile, 0, sizeof(PROFILE));
|
memset(&profile, 0, sizeof(PROFILE));
|
||||||
memcpy(profile.code, gProfileCode, sizeof(profile.code));
|
memcpy(profile.code, gProfileCode, sizeof(profile.code));
|
||||||
memcpy(profile.FLAG, FLAG, sizeof(profile.FLAG));
|
memcpy(profile.FLAG, FLAG, sizeof(profile.FLAG));
|
||||||
|
@ -110,15 +122,18 @@ BOOL SaveProfile(const char *name)
|
||||||
|
|
||||||
BOOL LoadProfile(const char *name)
|
BOOL LoadProfile(const char *name)
|
||||||
{
|
{
|
||||||
|
FILE *fp;
|
||||||
PROFILE profile;
|
PROFILE profile;
|
||||||
|
std::string path;
|
||||||
|
|
||||||
|
// Get path
|
||||||
|
if (name != NULL)
|
||||||
|
path = name;
|
||||||
|
else
|
||||||
|
path = gModulePath + '/' + gDefaultName;
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
FILE *fp;
|
fp = fopen(path.c_str(), "rb");
|
||||||
if (name != NULL)
|
|
||||||
fp = fopen(name, "rb");
|
|
||||||
else
|
|
||||||
fp = fopen((gModulePath + '/' + gDefaultName).c_str(), "rb");
|
|
||||||
|
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "SelStage.h"
|
#include "SelStage.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -156,11 +157,13 @@ void PutStageSelectObject(void)
|
||||||
|
|
||||||
int StageSelectLoop(int *p_event)
|
int StageSelectLoop(int *p_event)
|
||||||
{
|
{
|
||||||
|
std::string old_script_path;
|
||||||
|
|
||||||
RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
|
RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
|
||||||
|
|
||||||
gSelectedStage = 0;
|
gSelectedStage = 0;
|
||||||
BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcFull);
|
BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcFull);
|
||||||
auto old_script_path = GetTextScriptPath();
|
old_script_path = GetTextScriptPath();
|
||||||
LoadTextScript2("StageSelect.tsc");
|
LoadTextScript2("StageSelect.tsc");
|
||||||
gStageSelectTitleY = (WINDOW_HEIGHT / 2) - 66;
|
gStageSelectTitleY = (WINDOW_HEIGHT / 2) - 66;
|
||||||
StartTextScript(gPermitStage[gSelectedStage].index + 1000);
|
StartTextScript(gPermitStage[gSelectedStage].index + 1000);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -131,6 +132,8 @@ const STAGE_TABLE gTMT[95] = {
|
||||||
|
|
||||||
BOOL TransferStage(int no, int w, int x, int y)
|
BOOL TransferStage(int no, int w, int x, int y)
|
||||||
{
|
{
|
||||||
|
std::string path;
|
||||||
|
std::string path_dir;
|
||||||
BOOL bError;
|
BOOL bError;
|
||||||
|
|
||||||
// Move character
|
// Move character
|
||||||
|
@ -138,40 +141,47 @@ BOOL TransferStage(int no, int w, int x, int y)
|
||||||
|
|
||||||
bError = FALSE;
|
bError = FALSE;
|
||||||
|
|
||||||
|
// Get path
|
||||||
|
path_dir = "Stage";
|
||||||
|
|
||||||
// Load tileset
|
// Load tileset
|
||||||
auto path = std::string{"Stage/Prt"} + gTMT[no].parts;
|
path = path_dir + "/Prt" + gTMT[no].parts;
|
||||||
if (!ReloadBitmap_File(path.c_str(), SURFACE_ID_LEVEL_TILESET))
|
if (!ReloadBitmap_File(path.c_str(), SURFACE_ID_LEVEL_TILESET))
|
||||||
bError = TRUE;
|
bError = TRUE;
|
||||||
|
|
||||||
path = std::string{"Stage/"} + gTMT[no].parts + ".pxa";
|
path = path_dir + "Stage/" + gTMT[no].parts + ".pxa";
|
||||||
if (!LoadAttributeData(path.c_str()))
|
if (!LoadAttributeData(path.c_str()))
|
||||||
bError = TRUE;
|
bError = TRUE;
|
||||||
|
|
||||||
// Load tilemap
|
// Load tilemap
|
||||||
path = std::string{"Stage/"} + gTMT[no].map + ".pxm";
|
path = path_dir + "Stage/" + gTMT[no].map + ".pxm";
|
||||||
if (!LoadMapData2(path.c_str()))
|
if (!LoadMapData2(path.c_str()))
|
||||||
bError = TRUE;
|
bError = TRUE;
|
||||||
|
|
||||||
// Load NPCs
|
// Load NPCs
|
||||||
path = std::string{"Stage/"} + gTMT[no].map + ".pxe";
|
path = path_dir + "Stage/" + gTMT[no].map + ".pxe";
|
||||||
if (!LoadEvent(path.c_str()))
|
if (!LoadEvent(path.c_str()))
|
||||||
bError = TRUE;
|
bError = TRUE;
|
||||||
|
|
||||||
// Load script
|
// Load script
|
||||||
path = std::string{"Stage/"} + gTMT[no].map + ".tsc";
|
path = path_dir + "Stage/" + gTMT[no].map + ".tsc";
|
||||||
if (!LoadTextScript_Stage(path.c_str()))
|
if (!LoadTextScript_Stage(path.c_str()))
|
||||||
bError = TRUE;
|
bError = TRUE;
|
||||||
|
|
||||||
// Load background
|
// Load background
|
||||||
if (!InitBack(gTMT[no].back, gTMT[no].bkType))
|
path = gTMT[no].back;
|
||||||
|
if (!InitBack(path.c_str(), gTMT[no].bkType))
|
||||||
bError = TRUE;
|
bError = TRUE;
|
||||||
|
|
||||||
|
// Get path
|
||||||
|
path_dir = "Npc";
|
||||||
|
|
||||||
// Load NPC sprite sheets
|
// Load NPC sprite sheets
|
||||||
path = std::string{"Npc/Npc"} + gTMT[no].npc;
|
path = path_dir + "/Npc" + gTMT[no].npc;
|
||||||
if (!ReloadBitmap_File(path.c_str(), SURFACE_ID_LEVEL_SPRITESET_1))
|
if (!ReloadBitmap_File(path.c_str(), SURFACE_ID_LEVEL_SPRITESET_1))
|
||||||
bError = TRUE;
|
bError = TRUE;
|
||||||
|
|
||||||
path = std::string{"Npc/Npc"} + gTMT[no].boss;
|
path = path_dir + "/Npc" + gTMT[no].boss;
|
||||||
if (!ReloadBitmap_File(path.c_str(), SURFACE_ID_LEVEL_SPRITESET_2))
|
if (!ReloadBitmap_File(path.c_str(), SURFACE_ID_LEVEL_SPRITESET_2))
|
||||||
bError = TRUE;
|
bError = TRUE;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
|
@ -124,9 +125,10 @@ void EncryptionBinaryData2(unsigned char *pData, long size)
|
||||||
BOOL LoadTextScript2(const char *name)
|
BOOL LoadTextScript2(const char *name)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
std::string path;
|
||||||
|
|
||||||
// Get path
|
// Get path
|
||||||
auto path = gDataPath + '/' + name;
|
path = gDataPath + '/' + name;
|
||||||
|
|
||||||
gTS.size = GetFileSizeLong(path.c_str());
|
gTS.size = GetFileSizeLong(path.c_str());
|
||||||
if (gTS.size == -1)
|
if (gTS.size == -1)
|
||||||
|
@ -155,11 +157,13 @@ BOOL LoadTextScript2(const char *name)
|
||||||
BOOL LoadTextScript_Stage(const char *name)
|
BOOL LoadTextScript_Stage(const char *name)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
std::string path;
|
||||||
long head_size;
|
long head_size;
|
||||||
long body_size;
|
long body_size;
|
||||||
|
|
||||||
// Open Head.tsc
|
// Open Head.tsc
|
||||||
auto path = gDataPath + "/Head.tsc";
|
path = gDataPath + "/Head.tsc";
|
||||||
|
|
||||||
head_size = GetFileSizeLong(path.c_str());
|
head_size = GetFileSizeLong(path.c_str());
|
||||||
if (head_size == -1)
|
if (head_size == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -176,6 +180,7 @@ BOOL LoadTextScript_Stage(const char *name)
|
||||||
|
|
||||||
// Open stage's .tsc
|
// Open stage's .tsc
|
||||||
path = gDataPath + '/' + name;
|
path = gDataPath + '/' + name;
|
||||||
|
|
||||||
body_size = GetFileSizeLong(path.c_str());
|
body_size = GetFileSizeLong(path.c_str());
|
||||||
if (body_size == -1)
|
if (body_size == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -198,7 +203,7 @@ BOOL LoadTextScript_Stage(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current path
|
// Get current path
|
||||||
std::string GetTextScriptPath()
|
std::string GetTextScriptPath(void)
|
||||||
{
|
{
|
||||||
return gTS.path;
|
return gTS.path;
|
||||||
}
|
}
|
||||||
|
@ -1277,13 +1282,11 @@ int TextScriptProc(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The size of str_0 is the size of the format string (includes null terminator so that's the space we'll be using for ours) + the 3 chars from the format string
|
char str_0[0x40];
|
||||||
#ifdef JAPANESE
|
#ifdef JAPANESE
|
||||||
char str_0[sizeof("不明のコード:<") + (sizeof(char) * 3)];
|
|
||||||
sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
sprintf(str_0, "不明のコード:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
||||||
Backend_ShowMessageBox("エラー", str_0);
|
Backend_ShowMessageBox("エラー", str_0);
|
||||||
#else
|
#else
|
||||||
char str_0[sizeof("Unknown code:<%c%c%c") + (sizeof(char) * 3)];
|
|
||||||
sprintf(str_0, "Unknown code:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
sprintf(str_0, "Unknown code:<%c%c%c", gTS.data[gTS.p_read + 1], gTS.data[gTS.p_read + 2], gTS.data[gTS.p_read + 3]);
|
||||||
Backend_ShowMessageBox("Error", str_0);
|
Backend_ShowMessageBox("Error", str_0);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
typedef struct TEXT_SCRIPT
|
typedef struct TEXT_SCRIPT
|
||||||
{
|
{
|
||||||
// Path (reload when exit teleporter menu/inventory)
|
// Path (reload when exit teleporter menu/inventory)
|
||||||
|
@ -63,7 +64,7 @@ void EndTextScript(void);
|
||||||
void EncryptionBinaryData2(unsigned char *pData, long size);
|
void EncryptionBinaryData2(unsigned char *pData, long size);
|
||||||
BOOL LoadTextScript2(const char *name);
|
BOOL LoadTextScript2(const char *name);
|
||||||
BOOL LoadTextScript_Stage(const char *name);
|
BOOL LoadTextScript_Stage(const char *name);
|
||||||
std::string GetTextScriptPath();
|
std::string GetTextScriptPath(void);
|
||||||
BOOL StartTextScript(int no);
|
BOOL StartTextScript(int no);
|
||||||
void StopTextScript(void);
|
void StopTextScript(void);
|
||||||
void PutTextScript(void);
|
void PutTextScript(void);
|
||||||
|
|
Loading…
Add table
Reference in a new issue