mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-26 02:54:14 +01:00
buffer ini, cleanup defines
This commit is contained in:
parent
1ddf1834d2
commit
99fba1c037
@ -399,7 +399,6 @@ public:
|
||||
};
|
||||
|
||||
#ifdef AUDIO_OAL_USE_SNDFILE
|
||||
#if 1
|
||||
static sf_count_t sndfile_vio_get_filelen(void* user_data)
|
||||
{
|
||||
int32 pos = ftell((FILE*)user_data);
|
||||
@ -528,7 +527,8 @@ public:
|
||||
return size;
|
||||
}
|
||||
};
|
||||
#else
|
||||
|
||||
#if DR_WAV_IMPLEMENTATION
|
||||
static size_t drwav_read_replacement(void* pUserData, void* pBufferOut, size_t bytesToRead)
|
||||
{
|
||||
return fread(pBufferOut, 1, bytesToRead, (FILE*)pUserData);
|
||||
@ -1156,7 +1156,7 @@ CStream::CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBU
|
||||
if (!strcasecmp(&m_aFilename[strlen(m_aFilename) - strlen(".wav")], ".wav"))
|
||||
#ifdef AUDIO_OAL_USE_SNDFILE
|
||||
m_pSoundFile = new CSndFile(m_aFilename);
|
||||
#elif 0
|
||||
#elif defined(DR_WAV_IMPLEMENTATION)
|
||||
m_pSoundFile = new CDrWav(m_aFilename);
|
||||
#else
|
||||
m_pSoundFile = new CWavFile(m_aFilename);
|
||||
|
@ -11,12 +11,6 @@
|
||||
|
||||
const char *_psGetUserFilesFolder();
|
||||
|
||||
// io is really slow on the Wii U
|
||||
// so we're buffering files
|
||||
#ifdef __WIIU__
|
||||
#define BUFFER
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Windows FILE is BROKEN for GTA.
|
||||
*
|
||||
@ -29,7 +23,7 @@ struct myFILE
|
||||
{
|
||||
bool isText;
|
||||
FILE *file;
|
||||
#ifdef BUFFER
|
||||
#ifdef BUFFER_FILES
|
||||
char* buf;
|
||||
#endif
|
||||
};
|
||||
@ -90,7 +84,7 @@ found:
|
||||
myfiles[fd].file = fcaseopen(filename, realmode);
|
||||
if(myfiles[fd].file == nil)
|
||||
return 0;
|
||||
#ifdef BUFFER
|
||||
#ifdef BUFFER_FILES
|
||||
myfiles[fd].buf = (char*) memalign(0x40, IO_BUFFER_SIZE);
|
||||
setvbuf(myfiles[fd].file, myfiles[fd].buf, _IOFBF, IO_BUFFER_SIZE);
|
||||
#endif
|
||||
@ -105,7 +99,7 @@ myfclose(int fd)
|
||||
if(myfiles[fd].file){
|
||||
ret = fclose(myfiles[fd].file);
|
||||
myfiles[fd].file = nil;
|
||||
#ifdef BUFFER
|
||||
#ifdef BUFFER_FILES
|
||||
free(myfiles[fd].buf);
|
||||
#endif
|
||||
return ret;
|
||||
|
@ -141,8 +141,6 @@ enum Config {
|
||||
NUM_EXPLOSIONS = 48,
|
||||
};
|
||||
|
||||
#define IO_BUFFER_SIZE 128*1024
|
||||
|
||||
// We don't expect to compile for PS2 or Xbox
|
||||
// but it might be interesting for documentation purposes
|
||||
#define GTA_PC
|
||||
@ -410,6 +408,16 @@ enum Config {
|
||||
#define VC_RAIN_NERF // Reduces number of rain particles
|
||||
#endif
|
||||
|
||||
#ifdef __WIIU__
|
||||
#define KEEP_FRONTEND_LOADED
|
||||
#define BUFFER_FILES
|
||||
#endif
|
||||
|
||||
#ifdef BUFFER_FILES
|
||||
#define IO_BUFFER_SIZE (128*1024)
|
||||
#define INI_BUFFER_SIZE (8*1024) // 8k should be enough for the ini file
|
||||
#endif
|
||||
|
||||
#if defined __MWERKS__ || defined VANILLA_DEFINES
|
||||
#define FINAL
|
||||
#undef CHATTYSPLASH
|
||||
|
@ -33,6 +33,9 @@
|
||||
#include <cstdio> // for std::FILE
|
||||
#include <algorithm> // for std::find_if
|
||||
#include <functional> // for std::function
|
||||
#ifdef BUFFER_FILES
|
||||
#include <malloc.h> // for memalign
|
||||
#endif
|
||||
|
||||
namespace linb
|
||||
{
|
||||
@ -193,6 +196,11 @@ namespace linb
|
||||
string_type null_string;
|
||||
size_type pos;
|
||||
|
||||
#ifdef BUFFER_FILES
|
||||
char* buffer = (char*) memalign(0x40, INI_BUFFER_SIZE);
|
||||
setvbuf(f, buffer, _IOFBF, INI_BUFFER_SIZE);
|
||||
#endif
|
||||
|
||||
// Trims an string
|
||||
auto trim = [](string_type& s, bool trimLeft, bool trimRight) -> string_type&
|
||||
{
|
||||
@ -264,6 +272,9 @@ namespace linb
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
#ifdef BUFFER_FILES
|
||||
free(buffer);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -276,6 +287,10 @@ namespace linb
|
||||
{
|
||||
if(FILE* f = fopen(filename, "w"))
|
||||
{
|
||||
#ifdef BUFFER_FILES
|
||||
char* buffer = (char*) memalign(0x40, INI_BUFFER_SIZE);
|
||||
setvbuf(f, buffer, _IOFBF, INI_BUFFER_SIZE);
|
||||
#endif
|
||||
bool first = true;
|
||||
for(auto& sec : this->data)
|
||||
{
|
||||
@ -290,6 +305,9 @@ namespace linb
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
#ifdef BUFFER_FILES
|
||||
free(buffer);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user