PATH_LENGTH is actually Windows's MAX_PATH
When MAX_PATH isn't available, use FILENAME_MAX. This might be a bad idea.
This commit is contained in:
parent
070e4b1455
commit
03e513365b
19 changed files with 39 additions and 43 deletions
|
@ -365,7 +365,7 @@ void PutCampObject()
|
||||||
int CampLoop()
|
int CampLoop()
|
||||||
{
|
{
|
||||||
int arms_num;
|
int arms_num;
|
||||||
char old_script_path[PATH_LENGTH];
|
char old_script_path[MAX_PATH];
|
||||||
|
|
||||||
RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
|
RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ 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
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/%s.pbm", gDataPath, fName);
|
sprintf(path, "%s/%s.pbm", gDataPath, fName);
|
||||||
|
|
||||||
FILE *fp = fopen(path, "rb");
|
FILE *fp = fopen(path, "rb");
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define PATH_LENGTH 260 // Pixel had the path size locked to 260 (dangerously low), if you tried to open the executable in a path with more than around 220 characters, it'd crash.
|
|
||||||
|
|
||||||
#define WINDOW_WIDTH 320
|
#define WINDOW_WIDTH 320
|
||||||
#define WINDOW_HEIGHT 240
|
#define WINDOW_HEIGHT 240
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
#include "CommonDefines.h"
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "Tags.h"
|
#include "Tags.h"
|
||||||
|
@ -18,7 +17,7 @@ BOOL LoadConfigData(CONFIG *conf)
|
||||||
memset(conf, 0, sizeof(CONFIG));
|
memset(conf, 0, sizeof(CONFIG));
|
||||||
|
|
||||||
// Get path
|
// Get path
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/%s", gModulePath, config_filename);
|
sprintf(path, "%s/%s", gModulePath, config_filename);
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
|
|
|
@ -290,7 +290,7 @@ static unsigned char* LoadFileToMemory(const char *path, size_t *size)
|
||||||
|
|
||||||
static BOOL LoadBitmap_File(const char *name, SurfaceID surf_no, BOOL create_surface)
|
static BOOL LoadBitmap_File(const char *name, SurfaceID surf_no, BOOL create_surface)
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ BOOL StartCreditScript()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/%s", gDataPath, credit_script);
|
sprintf(path, "%s/%s", gDataPath, credit_script);
|
||||||
|
|
||||||
Credit.size = GetFileSizeLong(path);
|
Credit.size = GetFileSizeLong(path);
|
||||||
|
|
|
@ -702,7 +702,7 @@ BOOL Game(HWND hWnd)
|
||||||
|
|
||||||
PlaySoundObject(7, -1);
|
PlaySoundObject(7, -1);
|
||||||
|
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/npc.tbl", gDataPath);
|
sprintf(path, "%s/npc.tbl", gDataPath);
|
||||||
|
|
||||||
if (!LoadNpcTable(path))
|
if (!LoadNpcTable(path))
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
#include "CommonDefines.h"
|
|
||||||
#include "Tags.h"
|
#include "Tags.h"
|
||||||
|
|
||||||
void GetCompileDate(int *year, int *month, int *day)
|
void GetCompileDate(int *year, int *month, int *day)
|
||||||
|
@ -45,7 +44,7 @@ BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
|
||||||
VS_FIXEDFILEINFO *lpBuffer;
|
VS_FIXEDFILEINFO *lpBuffer;
|
||||||
DWORD dwHandle;
|
DWORD dwHandle;
|
||||||
DWORD dwLen;
|
DWORD dwLen;
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
LPVOID lpData;
|
LPVOID lpData;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
|
|
||||||
|
@ -112,9 +111,9 @@ BOOL GetCompileVersion(int *v1, int *v2, int *v3, int *v4)
|
||||||
// TODO - Inaccurate stack frame
|
// TODO - Inaccurate stack frame
|
||||||
BOOL OpenVolumeConfiguration(HWND hWnd)
|
BOOL OpenVolumeConfiguration(HWND hWnd)
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
char path2[PATH_LENGTH];
|
char path2[MAX_PATH];
|
||||||
char path3[PATH_LENGTH];
|
char path3[MAX_PATH];
|
||||||
int error1;
|
int error1;
|
||||||
int error2;
|
int error2;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@ -142,7 +141,7 @@ BOOL OpenVolumeConfiguration(HWND hWnd)
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
void DeleteDebugLog(void)
|
void DeleteDebugLog(void)
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
sprintf(path, "%s\\debug.txt", gModulePath);
|
sprintf(path, "%s\\debug.txt", gModulePath);
|
||||||
DeleteFileA(path);
|
DeleteFileA(path);
|
||||||
|
@ -150,7 +149,7 @@ void DeleteDebugLog(void)
|
||||||
|
|
||||||
BOOL PrintDebugLog(const char *string, int value1, int value2, int value3)
|
BOOL PrintDebugLog(const char *string, int value1, int value2, int value3)
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
sprintf(path, "%s\\debug.txt", gModulePath);
|
sprintf(path, "%s\\debug.txt", gModulePath);
|
||||||
|
@ -198,7 +197,7 @@ int CheckTime(SYSTEMTIME *system_time_low, SYSTEMTIME *system_time_high)
|
||||||
|
|
||||||
BOOL CheckFileExists(const char *name)
|
BOOL CheckFileExists(const char *name)
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
#ifdef NONPORTABLE
|
#ifdef NONPORTABLE
|
||||||
sprintf(path, "%s\\%s", gModulePath, name);
|
sprintf(path, "%s\\%s", gModulePath, name);
|
||||||
|
@ -250,7 +249,7 @@ long GetFileSizeLong(const char *path)
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
BOOL PrintBitmapError(char *string, int value)
|
BOOL PrintBitmapError(char *string, int value)
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
sprintf(path, "%s\\%s", gModulePath, "error.log");
|
sprintf(path, "%s\\%s", gModulePath, "error.log");
|
||||||
|
@ -320,7 +319,7 @@ BOOL CenterWindow(HWND hWnd)
|
||||||
// TODO - Inaccurate stack frame
|
// TODO - Inaccurate stack frame
|
||||||
BOOL LoadWindowRect(HWND hWnd, char *filename, BOOL unknown)
|
BOOL LoadWindowRect(HWND hWnd, char *filename, BOOL unknown)
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
int min_window_width;
|
int min_window_width;
|
||||||
int min_window_height;
|
int min_window_height;
|
||||||
int max_window_width;
|
int max_window_width;
|
||||||
|
@ -399,7 +398,7 @@ BOOL LoadWindowRect(HWND hWnd, char *filename, BOOL unknown)
|
||||||
|
|
||||||
BOOL SaveWindowRect(HWND hWnd, const char *filename)
|
BOOL SaveWindowRect(HWND hWnd, const char *filename)
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
WINDOWPLACEMENT wndpl;
|
WINDOWPLACEMENT wndpl;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
extern SDL_Window *gWindow;
|
extern SDL_Window *gWindow;
|
||||||
extern SDL_Renderer *gRenderer;
|
extern SDL_Renderer *gRenderer;
|
||||||
|
|
||||||
char gModulePath[PATH_LENGTH];
|
char gModulePath[MAX_PATH];
|
||||||
char gDataPath[PATH_LENGTH];
|
char gDataPath[MAX_PATH];
|
||||||
|
|
||||||
int gJoystickButtonTable[8];
|
int gJoystickButtonTable[8];
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ BOOL LoadMapData2(const char *path_map)
|
||||||
unsigned char dum;
|
unsigned char dum;
|
||||||
|
|
||||||
// Get path
|
// Get path
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/%s", gDataPath, path_map);
|
sprintf(path, "%s/%s", gDataPath, path_map);
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
|
@ -80,7 +80,7 @@ BOOL LoadMapData2(const char *path_map)
|
||||||
BOOL LoadAttributeData(const char *path_atrb)
|
BOOL LoadAttributeData(const char *path_atrb)
|
||||||
{
|
{
|
||||||
// Open file
|
// Open file
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/%s", gDataPath, path_atrb);
|
sprintf(path, "%s/%s", gDataPath, path_atrb);
|
||||||
|
|
||||||
FILE *fp = fopen(path, "rb");
|
FILE *fp = fopen(path, "rb");
|
||||||
|
|
|
@ -445,7 +445,7 @@ BOOL SaveTimeCounter()
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
// Get last time
|
// Get last time
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/290.rec", gModulePath);
|
sprintf(path, "%s/290.rec", gModulePath);
|
||||||
|
|
||||||
FILE *fp = fopen(path, "rb");
|
FILE *fp = fopen(path, "rb");
|
||||||
|
@ -530,7 +530,7 @@ int LoadTimeCounter()
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/290.rec", gModulePath);
|
sprintf(path, "%s/290.rec", gModulePath);
|
||||||
|
|
||||||
FILE *fp = fopen(path, "rb");
|
FILE *fp = fopen(path, "rb");
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
#include "ArmsItem.h"
|
#include "ArmsItem.h"
|
||||||
#include "CommonDefines.h"
|
|
||||||
#include "Caret.h"
|
#include "Caret.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
|
@ -60,7 +59,7 @@ BOOL LoadEvent(const char *path_event)
|
||||||
int n;
|
int n;
|
||||||
EVENT eve;
|
EVENT eve;
|
||||||
|
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/%s", gDataPath, path_event);
|
sprintf(path, "%s/%s", gDataPath, path_event);
|
||||||
|
|
||||||
fp = fopen(path, "rb");
|
fp = fopen(path, "rb");
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
#include "ArmsItem.h"
|
#include "ArmsItem.h"
|
||||||
#include "BossLife.h"
|
#include "BossLife.h"
|
||||||
#include "CommonDefines.h"
|
|
||||||
#include "Fade.h"
|
#include "Fade.h"
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "Flags.h"
|
#include "Flags.h"
|
||||||
|
@ -30,7 +29,7 @@ const char *gProfileCode = "Do041220";
|
||||||
|
|
||||||
BOOL IsProfile()
|
BOOL IsProfile()
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/%s", gModulePath, gDefaultName);
|
sprintf(path, "%s/%s", gModulePath, gDefaultName);
|
||||||
|
|
||||||
FILE *fp = fopen(path, "rb");
|
FILE *fp = fopen(path, "rb");
|
||||||
|
@ -46,7 +45,7 @@ BOOL SaveProfile(const char *name)
|
||||||
PROFILE profile;
|
PROFILE profile;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
const char *FLAG = "FLAG";
|
const char *FLAG = "FLAG";
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
// Get path
|
// Get path
|
||||||
if (name)
|
if (name)
|
||||||
|
@ -128,7 +127,7 @@ BOOL SaveProfile(const char *name)
|
||||||
BOOL LoadProfile(const char *name)
|
BOOL LoadProfile(const char *name)
|
||||||
{
|
{
|
||||||
// Get path
|
// Get path
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
sprintf(path, "%s", name);
|
sprintf(path, "%s", name);
|
||||||
|
|
|
@ -21,7 +21,6 @@ equivalents.
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
#include "CommonDefines.h"
|
|
||||||
#include "Organya.h"
|
#include "Organya.h"
|
||||||
#include "PixTone.h"
|
#include "PixTone.h"
|
||||||
#include "Tags.h"
|
#include "Tags.h"
|
||||||
|
@ -132,7 +131,7 @@ BOOL InitSoundObject(LPCSTR resname, int no)
|
||||||
|
|
||||||
BOOL LoadSoundObject(LPCSTR file_name, int no)
|
BOOL LoadSoundObject(LPCSTR file_name, int no)
|
||||||
{
|
{
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
DWORD i;
|
DWORD i;
|
||||||
DWORD file_size = 0;
|
DWORD file_size = 0;
|
||||||
char check_box[58];
|
char check_box[58];
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "Boss.h"
|
#include "Boss.h"
|
||||||
#include "Bullet.h"
|
#include "Bullet.h"
|
||||||
#include "Caret.h"
|
#include "Caret.h"
|
||||||
#include "CommonDefines.h"
|
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
#include "Flash.h"
|
#include "Flash.h"
|
||||||
#include "Frame.h"
|
#include "Frame.h"
|
||||||
|
@ -139,7 +138,7 @@ BOOL TransferStage(int no, int w, int x, int y)
|
||||||
strcpy(path_dir, "Stage");
|
strcpy(path_dir, "Stage");
|
||||||
|
|
||||||
//Load tileset
|
//Load tileset
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/Prt%s", path_dir, gTMT[no].parts);
|
sprintf(path, "%s/Prt%s", path_dir, gTMT[no].parts);
|
||||||
if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_TILESET))
|
if (!ReloadBitmap_File(path, SURFACE_ID_LEVEL_TILESET))
|
||||||
bError = TRUE;
|
bError = TRUE;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CommonDefines.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
extern char gModulePath[PATH_LENGTH];
|
extern char gModulePath[MAX_PATH];
|
||||||
extern char gDataPath[PATH_LENGTH];
|
extern char gDataPath[MAX_PATH];
|
||||||
|
|
|
@ -146,7 +146,7 @@ BOOL LoadTextScript2(const char *name)
|
||||||
BOOL LoadTextScript_Stage(const char *name)
|
BOOL LoadTextScript_Stage(const char *name)
|
||||||
{
|
{
|
||||||
//Open Head.tsc
|
//Open Head.tsc
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
sprintf(path, "%s/%s", gDataPath, "Head.tsc");
|
sprintf(path, "%s/%s", gDataPath, "Head.tsc");
|
||||||
|
|
||||||
long head_size = GetFileSizeLong(path);
|
long head_size = GetFileSizeLong(path);
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
|
|
||||||
#include "WindowsWrapper.h"
|
#include "WindowsWrapper.h"
|
||||||
|
|
||||||
#include "CommonDefines.h"
|
|
||||||
|
|
||||||
struct TEXT_SCRIPT
|
struct TEXT_SCRIPT
|
||||||
{
|
{
|
||||||
//Path (reload when exit teleporter menu/inventory)
|
//Path (reload when exit teleporter menu/inventory)
|
||||||
char path[PATH_LENGTH];
|
char path[MAX_PATH];
|
||||||
|
|
||||||
//Script buffer
|
//Script buffer
|
||||||
int size;
|
int size;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#undef CreateWindow
|
#undef CreateWindow
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
typedef int HWND;
|
typedef int HWND;
|
||||||
|
|
||||||
typedef int BOOL;
|
typedef int BOOL;
|
||||||
|
@ -35,6 +37,10 @@ struct RECT
|
||||||
rect.right = r; \
|
rect.right = r; \
|
||||||
rect.bottom = b;
|
rect.bottom = b;
|
||||||
|
|
||||||
|
#ifndef MAX_PATH
|
||||||
|
#define MAX_PATH FILENAME_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
int rep_rand();
|
int rep_rand();
|
||||||
void rep_srand(unsigned int seed);
|
void rep_srand(unsigned int seed);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue