mirror of
https://github.com/alexbatalov/fallout1-ce.git
synced 2024-07-08 14:09:28 +00:00
Refactor mve IO
This commit is contained in:
parent
3edbe3f311
commit
029528bdb3
|
@ -11,7 +11,6 @@
|
|||
#include "int/window.h"
|
||||
#include "movie_lib.h"
|
||||
#include "platform_compat.h"
|
||||
#include "pointer_registry.h"
|
||||
#include "plib/color/color.h"
|
||||
#include "plib/db/db.h"
|
||||
#include "plib/gnw/debug.h"
|
||||
|
@ -209,7 +208,6 @@ static DB_FILE* alphaHandle;
|
|||
static unsigned char* alphaBuf;
|
||||
|
||||
static SDL_Surface* gMovieSdlSurface = NULL;
|
||||
static int gMovieFileStreamPointerKey = 0;
|
||||
|
||||
// 0x4783F0
|
||||
void movieSetPreDrawFunc(MoviePreDrawFunc* func)
|
||||
|
@ -243,9 +241,9 @@ static void movieFree(void* ptr)
|
|||
}
|
||||
|
||||
// 0x47843C
|
||||
static bool movieRead(int fileHandle, void* buf, int count)
|
||||
static bool movieRead(void* handle, void* buf, int count)
|
||||
{
|
||||
return db_fread(buf, 1, count, (DB_FILE*)intToPtr(fileHandle)) == count;
|
||||
return db_fread(buf, 1, count, reinterpret_cast<DB_FILE*>(handle)) == count;
|
||||
}
|
||||
|
||||
// 0x478464
|
||||
|
@ -829,8 +827,6 @@ static int movieStart(int win, char* filePath, int (*a3)())
|
|||
return 1;
|
||||
}
|
||||
|
||||
gMovieFileStreamPointerKey = ptrToInt(handle);
|
||||
|
||||
GNWWin = win;
|
||||
running = 1;
|
||||
movieFlags &= ~MOVIE_EXTENDED_FLAG_0x01;
|
||||
|
@ -858,7 +854,7 @@ static int movieStart(int win, char* filePath, int (*a3)())
|
|||
v15 = 0;
|
||||
}
|
||||
|
||||
_MVE_rmPrepMovie(gMovieFileStreamPointerKey, v15, v16, v17);
|
||||
_MVE_rmPrepMovie(handle, v15, v16, v17);
|
||||
|
||||
if (movieScaleFlag) {
|
||||
debug_printf("scaled\n");
|
||||
|
|
|
@ -33,7 +33,7 @@ typedef struct STRUCT_4F6930 {
|
|||
int field_0;
|
||||
MovieReadProc* readProc;
|
||||
STRUCT_6B3690 field_8;
|
||||
int fileHandle;
|
||||
void* fileHandle;
|
||||
int field_18;
|
||||
SDL_Surface* field_24;
|
||||
SDL_Surface* field_28;
|
||||
|
@ -56,7 +56,7 @@ static void _MVE_MemInit(STRUCT_6B3690* a1, int a2, void* a3);
|
|||
static void _MVE_MemFree(STRUCT_6B3690* a1);
|
||||
static void _do_nothing_2(SDL_Surface* a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9);
|
||||
static int _sub_4F4B5();
|
||||
static int _ioReset(int fileHandle);
|
||||
static int _ioReset(void* handle);
|
||||
static void* _ioRead(int size);
|
||||
static void* _MVE_MemAlloc(STRUCT_6B3690* a1, unsigned int a2);
|
||||
static unsigned char* _ioNextRecord();
|
||||
|
@ -393,7 +393,7 @@ static int _rm_dy;
|
|||
static int _gSoundTimeBase;
|
||||
|
||||
// 0x6B39CC
|
||||
static int _io_handle;
|
||||
static void* _io_handle;
|
||||
|
||||
// 0x6B39D0
|
||||
static int _rm_len;
|
||||
|
@ -639,7 +639,7 @@ void _MVE_rmFrameCounts(int* a1, int* a2)
|
|||
}
|
||||
|
||||
// 0x4F4BF0
|
||||
int _MVE_rmPrepMovie(int fileHandle, int a2, int a3, char a4)
|
||||
int _MVE_rmPrepMovie(void* handle, int a2, int a3, char a4)
|
||||
{
|
||||
_sub_4F4DD();
|
||||
|
||||
|
@ -651,7 +651,7 @@ int _MVE_rmPrepMovie(int fileHandle, int a2, int a3, char a4)
|
|||
_rm_track_bit = 1;
|
||||
}
|
||||
|
||||
if (!_ioReset(fileHandle)) {
|
||||
if (!_ioReset(handle)) {
|
||||
_MVE_rmEndMovie();
|
||||
return -8;
|
||||
}
|
||||
|
@ -673,11 +673,11 @@ int _MVE_rmPrepMovie(int fileHandle, int a2, int a3, char a4)
|
|||
}
|
||||
|
||||
// 0x4F4C90
|
||||
static int _ioReset(int stream)
|
||||
static int _ioReset(void* handle)
|
||||
{
|
||||
Mve* mve;
|
||||
|
||||
_io_handle = stream;
|
||||
_io_handle = handle;
|
||||
|
||||
mve = (Mve*)_ioRead(sizeof(Mve));
|
||||
if (mve == NULL) {
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace fallout {
|
|||
|
||||
typedef void*(MveMallocFunc)(size_t size);
|
||||
typedef void(MveFreeFunc)(void* ptr);
|
||||
typedef bool MovieReadProc(int fileHandle, void* buffer, int count);
|
||||
typedef bool MovieReadProc(void* handle, void* buffer, int count);
|
||||
typedef void(MovieShowFrameProc)(SDL_Surface*, int, int, int, int, int, int, int, int);
|
||||
|
||||
void movieLibSetMemoryProcs(MveMallocFunc* mallocProc, MveFreeFunc* freeProc);
|
||||
|
@ -20,7 +20,7 @@ void movieLibSetPaletteEntriesProc(void (*fn)(unsigned char*, int, int));
|
|||
void _MVE_rmCallbacks(int (*fn)());
|
||||
void _sub_4F4BB(int a1);
|
||||
void _MVE_rmFrameCounts(int* a1, int* a2);
|
||||
int _MVE_rmPrepMovie(int fileHandle, int a2, int a3, char a4);
|
||||
int _MVE_rmPrepMovie(void* handle, int a2, int a3, char a4);
|
||||
int _MVE_rmStepMovie();
|
||||
void _MVE_rmEndMovie();
|
||||
void _MVE_ReleaseMem();
|
||||
|
|
Loading…
Reference in New Issue
Block a user