mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-26 11:04:15 +01:00
Use setvbuf with a 128KiB buffer instead of setbuf (#1)
This commit is contained in:
parent
4dd847d367
commit
1802fcffa1
@ -83,14 +83,14 @@ public:
|
||||
{
|
||||
memset(&m_soundInfo, 0, sizeof(m_soundInfo));
|
||||
|
||||
m_buffer = (char*) memalign(0x40, BUFSIZ);
|
||||
m_buffer = (char*) memalign(0x40, IO_BUFFER_SIZE);
|
||||
|
||||
m_fileHandle = fopen(path, "rb");
|
||||
if (!m_fileHandle) {
|
||||
return;
|
||||
}
|
||||
|
||||
setbuf(m_fileHandle, m_buffer);
|
||||
setvbuf(m_fileHandle, m_buffer, _IOFBF, IO_BUFFER_SIZE);
|
||||
|
||||
m_pfSound = sf_open_virtual(&vio, SFM_READ, &m_soundInfo, m_fileHandle);
|
||||
}
|
||||
@ -177,14 +177,14 @@ public:
|
||||
{
|
||||
memset(&m_drWav, 0, sizeof(m_drWav));
|
||||
|
||||
m_buffer = (char*) memalign(0x40, BUFSIZ);
|
||||
m_buffer = (char*) memalign(0x40, IO_BUFFER_SIZE);
|
||||
|
||||
m_fileHandle = fopen(path, "rb");
|
||||
if (!m_fileHandle) {
|
||||
return;
|
||||
}
|
||||
|
||||
setbuf(m_fileHandle, m_buffer);
|
||||
setvbuf(m_fileHandle, m_buffer, _IOFBF, IO_BUFFER_SIZE);
|
||||
|
||||
if( !drwav_init(&m_drWav, drwav_read_replacement, drwav_seek_replacement, m_fileHandle, NULL) ) {
|
||||
return;
|
||||
@ -300,7 +300,7 @@ public:
|
||||
int channels = 0;
|
||||
int encoding = 0;
|
||||
|
||||
m_buffer = (char*) memalign(0x40, BUFSIZ);
|
||||
m_buffer = (char*) memalign(0x40, IO_BUFFER_SIZE);
|
||||
|
||||
m_fileHandle = fopen(path, "rb");
|
||||
if (!m_fileHandle) {
|
||||
@ -308,7 +308,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
setbuf(m_fileHandle, m_buffer);
|
||||
setvbuf(m_fileHandle, m_buffer, _IOFBF, IO_BUFFER_SIZE);
|
||||
|
||||
m_bOpened = mpg123_replace_reader_handle(m_pMH, mpg123_read_replacement, mpg123_seek_replacement, NULL) == MPG123_OK
|
||||
&& mpg123_open_handle(m_pMH, m_fileHandle) == MPG123_OK
|
||||
|
@ -91,8 +91,8 @@ found:
|
||||
if(myfiles[fd].file == nil)
|
||||
return 0;
|
||||
#ifdef BUFFER
|
||||
myfiles[fd].buf = (char*) memalign(0x40, BUFSIZ);
|
||||
setbuf(myfiles[fd].file, myfiles[fd].buf);
|
||||
myfiles[fd].buf = (char*) memalign(0x40, IO_BUFFER_SIZE);
|
||||
setvbuf(myfiles[fd].file, myfiles[fd].buf, _IOFBF, IO_BUFFER_SIZE);
|
||||
#endif
|
||||
return fd;
|
||||
}
|
||||
|
@ -135,6 +135,8 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user