mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 10:22:48 +01:00
- remove __unix__ and make fixslashes always here
This commit is contained in:
parent
8f09f9d61a
commit
3a3e0dd664
@ -8,7 +8,6 @@
|
||||
#include "SOUND.H"
|
||||
#include "PAD.H"
|
||||
#include "MISSION.H"
|
||||
#include "COP_AI.H"
|
||||
#include "SCORES.H"
|
||||
#include "LIBGPU.H"
|
||||
#include "LIBETC.H"
|
||||
@ -17,9 +16,7 @@
|
||||
#include "PAUSE.H"
|
||||
|
||||
#ifndef PSX
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <PLATFORM.H>
|
||||
|
||||
// [A]
|
||||
|
@ -16,7 +16,8 @@
|
||||
#include "MAIN.H"
|
||||
#include "PAD.H"
|
||||
#include "DRAW.H"
|
||||
#include <string.h>
|
||||
#include "STRINGS.H"
|
||||
#include "PLATFORM.H"
|
||||
|
||||
// Initialized in redriver2_main
|
||||
char* _overlay_buffer = NULL; // 0x1C0000
|
||||
@ -377,10 +378,7 @@ int Loadfile(char* name, char* addr)
|
||||
int fileSize;
|
||||
|
||||
sprintf(namebuffer, "%s%s", gDataFolder, name);
|
||||
|
||||
#ifdef __unix__
|
||||
fixslashes(namebuffer);
|
||||
#endif
|
||||
FixPathSlashes(namebuffer);
|
||||
|
||||
FILE* fptr = fopen(namebuffer, "rb");
|
||||
if (!fptr)
|
||||
@ -462,13 +460,10 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize)
|
||||
{
|
||||
char namebuffer[64];
|
||||
#ifndef PSX
|
||||
int fileSize = 0;
|
||||
int fileSize;
|
||||
|
||||
sprintf(namebuffer, "%s%s", gDataFolder, name);
|
||||
|
||||
#ifdef __unix__
|
||||
fixslashes(namebuffer);
|
||||
#endif
|
||||
FixPathSlashes(namebuffer);
|
||||
|
||||
FILE* fptr = fopen(namebuffer, "rb");
|
||||
if (!fptr)
|
||||
@ -793,13 +788,9 @@ void loadsectors(char* addr, int sector, int nsectors)
|
||||
// It has to be this way
|
||||
void loadsectorsPC(char* filename, char* addr, int sector, int nsectors)
|
||||
{
|
||||
#ifdef __unix__
|
||||
char namebuffer[64];
|
||||
strcpy(namebuffer, filename);
|
||||
fixslashes(namebuffer);
|
||||
#else
|
||||
char* namebuffer = filename;
|
||||
#endif
|
||||
FixPathSlashes(namebuffer);
|
||||
|
||||
FILE* fp = fopen(namebuffer, "rb");
|
||||
|
||||
@ -1378,10 +1369,7 @@ void SetCityType(CITYTYPE type)
|
||||
}
|
||||
|
||||
sprintf(filename, format, gDataFolder, LevelFiles[GameLevel]);
|
||||
|
||||
#ifdef __unix__
|
||||
fixslashes(filename);
|
||||
#endif
|
||||
FixPathSlashes(filename);
|
||||
|
||||
FILE* levFp = fopen(filename, "rb");
|
||||
|
||||
@ -1389,6 +1377,7 @@ void SetCityType(CITYTYPE type)
|
||||
{
|
||||
char errPrint[1024];
|
||||
sprintf(errPrint, "SetCityType: cannot open level '%s'\n", filename);
|
||||
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL);
|
||||
return;
|
||||
}
|
||||
@ -1508,10 +1497,7 @@ int FileExists(char* filename)
|
||||
char namebuffer[128];
|
||||
|
||||
sprintf(namebuffer, "%s%s", gDataFolder, filename);
|
||||
|
||||
#ifdef __unix__
|
||||
fixslashes(namebuffer);
|
||||
#endif
|
||||
FixPathSlashes(namebuffer);
|
||||
|
||||
FILE* fp = fopen(namebuffer, "rb");
|
||||
if (fp)
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "CAMERA.H"
|
||||
#include "FMVPLAY.H"
|
||||
#include "PAUSE.H"
|
||||
#include "PLATFORM.H"
|
||||
#include "SOUND.H"
|
||||
#include "PRES.H"
|
||||
#include "SYSTEM.H"
|
||||
@ -353,6 +354,7 @@ void PlayXA(int num, int index)
|
||||
{
|
||||
char fileName[250];
|
||||
sprintf(fileName, XANameFormat, gDataFolder, num+1, index);
|
||||
fixslashes(fileName);
|
||||
|
||||
g_wavData = new CSoundSource_WaveCache();
|
||||
|
||||
@ -362,6 +364,7 @@ void PlayXA(int num, int index)
|
||||
// Save subtitles file
|
||||
{
|
||||
sprintf(fileName, "%sXA\\XABNK0%d.XA[%d].SBN", gDataFolder, num + 1, index);
|
||||
fixslashes(fileName);
|
||||
|
||||
FILE* fp = fopen(fileName, "wb");
|
||||
|
||||
@ -389,6 +392,7 @@ void PlayXA(int num, int index)
|
||||
#else
|
||||
// Load subtitles for XA
|
||||
sprintf(fileName, "%sXA\\XABNK0%d.XA[%d].SBN", gDataFolder, num + 1, index);
|
||||
fixslashes(fileName);
|
||||
|
||||
FILE* fp = fopen(fileName, "rb");
|
||||
|
||||
|
@ -2,18 +2,34 @@
|
||||
#define PLATFORM_H
|
||||
|
||||
#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)
|
||||
#include <direct.h>
|
||||
|
||||
#define HOME_ENV "USERPROFILE"
|
||||
|
||||
inline void FixPathSlashes(char* pathbuff)
|
||||
{
|
||||
while (*pathbuff)
|
||||
{
|
||||
if (*pathbuff == '\\') *pathbuff = '/';
|
||||
if (*pathbuff == '/') // make windows-style path
|
||||
*pathbuff = '\\';
|
||||
pathbuff++;
|
||||
}
|
||||
}
|
||||
|
||||
#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 FixPathSlashes(char* pathbuff)
|
||||
{
|
||||
while (*pathbuff)
|
||||
{
|
||||
if (*pathbuff == '\\') // make unix-style path
|
||||
*pathbuff = '/';
|
||||
pathbuff++;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
#ifndef _SYS_TYPES_H
|
||||
#define _SYS_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
/* major part of a device */
|
||||
#define major(x) ((int)(((unsigned)(x)>>8)&0377))
|
||||
|
@ -4,15 +4,12 @@
|
||||
#include "DRIVER2.H"
|
||||
#include "C/MAIN.H"
|
||||
#include "C/SYSTEM.H"
|
||||
#include "C/GLAUNCH.H"
|
||||
#include "C/PLAYERS.H"
|
||||
#include "C/GAMESND.H"
|
||||
|
||||
#include "EMULATOR.H"
|
||||
#include "EMULATOR_PRIVATE.H"
|
||||
#include "utils/ini.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <SDL_scancode.h>
|
||||
|
||||
#include "C/CUTSCENE.H"
|
||||
|
@ -464,6 +464,7 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles)
|
||||
|
||||
char filename[250];
|
||||
sprintf(filename, "%sFMV\\%d\\RENDER%d.STR[0].AVI", gDataFolder, fd, arg->render);
|
||||
FixPathSlashes(filename);
|
||||
|
||||
ReadAVI readAVI(filename);
|
||||
|
||||
@ -471,6 +472,8 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles)
|
||||
if (subtitles)
|
||||
{
|
||||
sprintf(filename, "%sFMV\\%d\\RENDER%d.SBN", gDataFolder, fd, arg->render);
|
||||
FixPathSlashes(filename);
|
||||
|
||||
InitSubtitles(filename);
|
||||
}
|
||||
else
|
||||
@ -481,6 +484,8 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles)
|
||||
if(arg->credits)
|
||||
{
|
||||
sprintf(filename, "%sDATA\\CREDITS.ENG", gDataFolder);
|
||||
FixPathSlashes(filename);
|
||||
|
||||
InitCredits(filename);
|
||||
}
|
||||
|
||||
@ -489,7 +494,8 @@ void DoPlayFMV(RENDER_ARG* arg, int subtitles)
|
||||
ReadAVI::stream_format_t stream_format = readAVI.GetVideoFormat();
|
||||
ReadAVI::stream_format_auds_t audio_format = readAVI.GetAudioFormat();
|
||||
|
||||
if (strcmp(stream_format.compression_type, "MJPG")) {
|
||||
if (strcmp(stream_format.compression_type, "MJPG"))
|
||||
{
|
||||
printf("Only MJPG supported\n");
|
||||
return;
|
||||
}
|
||||
@ -639,7 +645,6 @@ int FMV_main(RENDER_ARGS* args)
|
||||
DRAWENV draw;
|
||||
|
||||
FMVPlayerInitGL();
|
||||
//LoadFont(NULL);
|
||||
|
||||
InitFMVFont();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user