mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 02:12:43 +01:00
Merge branch 'linux' of https://github.com/andre-vm/REDRIVER2 into andre-vm-linux
This commit is contained in:
commit
788f686080
@ -39,7 +39,7 @@ install:
|
||||
- set GLEW_URL="https://netix.dl.sourceforge.net/project/glew/glew/2.1.0/glew-2.1.0-win32.zip"
|
||||
- appveyor DownloadFile %GLEW_URL% -FileName GLEW.zip
|
||||
- 7z x GLEW.zip -o%dependency_folder%
|
||||
- set OPENAL_URL="https://kcat.strangesoft.net/openal-binaries/openal-soft-1.20.1-bin.zip"
|
||||
- set OPENAL_URL="https://openal-soft.org/openal-binaries/openal-soft-1.20.1-bin.zip"
|
||||
- appveyor DownloadFile %OPENAL_URL% -FileName OPENAL.zip
|
||||
- 7z x OPENAL.zip -o%dependency_folder%
|
||||
- set JPEG_URL="http://www.ijg.org/files/jpegsr9d.zip"
|
||||
|
@ -62,7 +62,7 @@ void GetGameProfilePath(char* str)
|
||||
{
|
||||
char* homepath;
|
||||
|
||||
homepath = getenv("USERPROFILE"); // "USERPROFILE"
|
||||
homepath = getenv(HOME_ENV); // "USERPROFILE"
|
||||
|
||||
if (homepath)
|
||||
{
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <PLATFORM.H>
|
||||
|
||||
// Initialized in redriver2_main
|
||||
char* _overlay_buffer = NULL; // 0x1C0000
|
||||
char* _frontend_buffer = NULL; // 0xFB400
|
||||
@ -348,6 +350,10 @@ int Loadfile(char *name, char *addr)
|
||||
|
||||
sprintf(namebuffer, "DRIVER2\\%s", name);
|
||||
|
||||
#ifdef __unix__
|
||||
fixslashes(namebuffer);
|
||||
#endif
|
||||
|
||||
FILE* fptr = fopen(namebuffer, "rb");
|
||||
if (!fptr)
|
||||
{
|
||||
@ -431,6 +437,10 @@ int LoadfileSeg(char *name, char *addr, int offset, int loadsize)
|
||||
|
||||
sprintf(namebuffer, "DRIVER2\\%s", name);
|
||||
|
||||
#ifdef __unix__
|
||||
fixslashes(namebuffer);
|
||||
#endif
|
||||
|
||||
FILE* fptr = fopen(namebuffer, "rb");
|
||||
if (!fptr)
|
||||
{
|
||||
@ -762,12 +772,20 @@ void loadsectors(char *addr, int sector, int nsectors)
|
||||
// It has to be this way
|
||||
void loadsectorsPC(char* filename, char* addr, int sector, int nsectors)
|
||||
{
|
||||
FILE* fp = fopen(filename, "rb");
|
||||
#ifdef __unix__
|
||||
char namebuffer[64];
|
||||
strcpy(namebuffer, filename);
|
||||
fixslashes(namebuffer);
|
||||
#else
|
||||
char* namebuffer = filename;
|
||||
#endif
|
||||
|
||||
FILE* fp = fopen(namebuffer, "rb");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
char errPrint[512];
|
||||
sprintf(errPrint, "loadsectorsPC: failed to open '%s'\n", filename);
|
||||
sprintf(errPrint, "loadsectorsPC: failed to open '%s'\n", namebuffer);
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL);
|
||||
return;
|
||||
}
|
||||
@ -1358,6 +1376,10 @@ void SetCityType(CITYTYPE type)
|
||||
|
||||
sprintf(filename, format, LevelFiles[GameLevel]);
|
||||
|
||||
#ifdef __unix__
|
||||
fixslashes(filename);
|
||||
#endif
|
||||
|
||||
FILE* levFp = fopen(filename, "rb");
|
||||
|
||||
if (!levFp)
|
||||
@ -1484,6 +1506,10 @@ int FileExists(char *filename)
|
||||
|
||||
sprintf(namebuffer, "DRIVER2\\%s", filename);
|
||||
|
||||
#ifdef __unix__
|
||||
fixslashes(namebuffer);
|
||||
#endif
|
||||
|
||||
FILE* fp = fopen(namebuffer, "rb");
|
||||
if (fp)
|
||||
{
|
||||
|
@ -39,12 +39,12 @@ extern void sys_freeall();
|
||||
#ifdef __GNUC__
|
||||
#define MALLOC_END() \
|
||||
if(mallocptr > _oldmalloc)\
|
||||
printWarning("malloc(%d) in " __FUNCTION__ ", line %d. Malloc usage: %d\n", mallocptr-_oldmalloc, __LINE__, (mallocptr-mallocptr_start));\
|
||||
printWarning("malloc(%d) in %s, line %d. Malloc usage: %d\n", mallocptr-_oldmalloc, __FUNCTION__, __LINE__, (mallocptr-mallocptr_start));\
|
||||
} // MALLOC_BEGIN block
|
||||
#else
|
||||
#define MALLOC_END() \
|
||||
if(mallocptr > _oldmalloc)\
|
||||
printWarning("malloc(%d) in %s, line %d. Malloc usage: %d\n", mallocptr-_oldmalloc, __FUNCTION__, __LINE__, (mallocptr-mallocptr_start));\
|
||||
printWarning("malloc(%d) in " __FUNCTION__ ", line %d. Malloc usage: %d\n", mallocptr-_oldmalloc, __LINE__, (mallocptr-mallocptr_start));\
|
||||
} // MALLOC_BEGIN block
|
||||
#endif
|
||||
|
||||
|
@ -3,9 +3,20 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#define HOME_ENV "USERPROFILE"
|
||||
#elif defined (__unix__)
|
||||
#include <sys/stat.h>
|
||||
#define HOME_ENV "HOME"
|
||||
#define _mkdir(str) mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)
|
||||
|
||||
inline void fixslashes(char* pathbuff)
|
||||
{
|
||||
while (*pathbuff)
|
||||
{
|
||||
if (*pathbuff == '\\') *pathbuff = '/';
|
||||
pathbuff++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
@ -111,7 +111,12 @@ project "REDRIVER2"
|
||||
}
|
||||
|
||||
filter "system:linux"
|
||||
buildoptions { "-Wno-narrowing", "-fpermissive" }
|
||||
buildoptions {
|
||||
"-Wno-narrowing",
|
||||
"-fpermissive",
|
||||
"-m32"
|
||||
}
|
||||
|
||||
cppdialect "C++11"
|
||||
|
||||
includedirs {
|
||||
@ -125,7 +130,10 @@ project "REDRIVER2"
|
||||
"SDL2",
|
||||
}
|
||||
|
||||
linkoptions { "-z muldefs" }
|
||||
linkoptions {
|
||||
"-z muldefs",
|
||||
"-m32"
|
||||
}
|
||||
|
||||
filter "system:psx"
|
||||
defines { "PSX" }
|
||||
|
@ -47,7 +47,8 @@ project "PSX"
|
||||
|
||||
filter "system:linux"
|
||||
buildoptions {
|
||||
"-Wno-narrowing"
|
||||
"-Wno-narrowing",
|
||||
"-m32",
|
||||
}
|
||||
|
||||
includedirs {
|
||||
@ -57,9 +58,13 @@ project "PSX"
|
||||
links {
|
||||
"GL",
|
||||
"GLEW",
|
||||
"openal", -- FIXME: is linux using openal-soft?
|
||||
"openal",
|
||||
"SDL2",
|
||||
}
|
||||
|
||||
linkoptions {
|
||||
"-m32"
|
||||
}
|
||||
|
||||
filter "configurations:Release"
|
||||
optimize "Full"
|
Loading…
Reference in New Issue
Block a user