Review MVE_rmPrepMovie

This commit is contained in:
Alexander Batalov
2025-02-10 21:13:05 +03:00
parent 48c01eb8a1
commit 625bf69b33
3 changed files with 37 additions and 63 deletions
+2 -13
View File
@@ -812,10 +812,6 @@ static void movieRenderSubtitles()
// 0x487710
static int _movieStart(int win, char* filePath, int (*a3)())
{
int v15;
int v16;
int v17;
if (_running) {
return 1;
}
@@ -841,21 +837,14 @@ static int _movieStart(int win, char* filePath, int (*a3)())
debugPrint("Playing at (%d, %d) ", _movieX + gMovieWindowRect.left, _movieY + gMovieWindowRect.top);
_MVE_rmCallbacks(a3);
_MVE_sfCallbacks(movieDirectImpl);
v17 = 0;
v16 = _movieY + gMovieWindowRect.top;
v15 = _movieX + gMovieWindowRect.left;
MVE_rmPrepMovie(gMovieFileStream, _movieX + gMovieWindowRect.left, _movieY + gMovieWindowRect.top, 0);
} else {
debugPrint("Buffered ");
_MVE_rmCallbacks(a3);
_MVE_sfCallbacks(movieBufferedImpl);
v17 = 0;
v16 = 0;
v15 = 0;
MVE_rmPrepMovie(gMovieFileStream, 0, 0, 0);
}
_MVE_rmPrepMovie(gMovieFileStream, v15, v16, v17);
if (_movieScaleFlag) {
debugPrint("scaled\n");
} else {
+34 -49
View File
@@ -61,7 +61,6 @@ static int _ioReset(void* handle);
static void* _ioRead(int size);
static void* _MVE_MemAlloc(STRUCT_6B3690* a1, unsigned int a2);
static unsigned char* _ioNextRecord();
static void _sub_4F4DD();
static int _MVE_rmHoldMovie();
static int _syncWait();
static void _MVE_sndPause();
@@ -162,10 +161,10 @@ static MovieShowFrameProc* _sf_ShowFrame = _do_nothing_2;
static void (*_pal_SetPalette)(unsigned char*, int, int) = nullptr;
// 0x51EE18
static int _rm_hold = 0;
static int rm_hold = 0;
// 0x51EE1C
static int _rm_active = 0;
static int rm_active = 0;
// 0x51EE20
static bool dword_51EE20 = false;
@@ -373,10 +372,10 @@ static MveMallocFunc* mve_malloc_func;
static int (*_rm_ctl)();
// 0x6B39C0
static int _rm_dx;
static int rm_dx;
// 0x6B39C4
static int _rm_dy;
static int rm_dy;
// 0x6B39C8
static int _gSoundTimeBase;
@@ -385,7 +384,7 @@ static int _gSoundTimeBase;
static void* _io_handle;
// 0x6B39D0
static int _rm_len;
static int rm_len;
// 0x6B39D4
static MveFreeFunc* mve_free_func;
@@ -394,7 +393,7 @@ static MveFreeFunc* mve_free_func;
static int _snd_comp;
// 0x6B39DC
static unsigned char* _rm_p;
static unsigned char* rm_p;
// 0x6B39E0
static int dword_6B39E0[60];
@@ -403,7 +402,7 @@ static int dword_6B39E0[60];
static int _sync_wait_quanta;
// 0x6B3AD8
static int _rm_track_bit;
static int rm_track_bit;
// 0x6B3ADC
static int _sync_time;
@@ -574,16 +573,14 @@ void MVE_rmFrameCounts(int* frame_count_ptr, int* frame_drop_count_ptr)
}
// 0x4F4BF0
int _MVE_rmPrepMovie(void* handle, int a2, int a3, char a4)
int MVE_rmPrepMovie(void* handle, int dx, int dy, unsigned char track)
{
_sub_4F4DD();
rm_dx = dx;
rm_dy = dy;
rm_track_bit = 1 << track;
_rm_dx = a2;
_rm_dy = a3;
_rm_track_bit = 1 << a4;
if (_rm_track_bit == 0) {
_rm_track_bit = 1;
if (rm_track_bit == 0) {
rm_track_bit = 1;
}
if (!_ioReset(handle)) {
@@ -591,16 +588,16 @@ int _MVE_rmPrepMovie(void* handle, int a2, int a3, char a4)
return -8;
}
_rm_p = _ioNextRecord();
_rm_len = 0;
rm_p = _ioNextRecord();
rm_len = 0;
if (!_rm_p) {
if (rm_p == NULL) {
_MVE_rmEndMovie();
return -2;
}
_rm_active = 1;
_rm_hold = 0;
rm_active = 1;
rm_hold = 0;
rm_FrameCount = 0;
rm_FrameDropCount = 0;
@@ -697,24 +694,12 @@ static unsigned char* _ioNextRecord()
return buf;
}
// 0x4F4DD0
static void _sub_4F4DD()
{
if (dword_51EE20) {
return;
}
// TODO: Incomplete.
dword_51EE20 = true;
}
// 0x4F4E20
static int _MVE_rmHoldMovie()
{
if (!_rm_hold) {
if (!rm_hold) {
_MVE_sndPause();
_rm_hold = 1;
rm_hold = 1;
}
_syncWait();
return 0;
@@ -769,16 +754,16 @@ int _MVE_rmStepMovie()
int v20;
unsigned char* v14;
v0 = _rm_len;
v1 = (unsigned short*)_rm_p;
v0 = rm_len;
v1 = (unsigned short*)rm_p;
if (!_rm_active) {
if (!rm_active) {
return -10;
}
if (_rm_hold) {
if (rm_hold) {
_MVE_sndResume();
_rm_hold = 0;
rm_hold = 0;
}
LABEL_5:
@@ -850,7 +835,7 @@ LABEL_5:
v11 >>= 1;
}
v12 = _rm_dx;
v12 = rm_dx;
if (v12 < 0) {
v12 = 0;
}
@@ -860,7 +845,7 @@ LABEL_5:
break;
}
v13 = _rm_dy;
v13 = rm_dy;
if (v13 < 0) {
v13 = 0;
}
@@ -892,9 +877,9 @@ LABEL_5:
}
if (v21) {
_do_nothing_(_rm_dx, _rm_dy, v21);
_do_nothing_(rm_dx, rm_dy, v21);
} else if (!_sync_late || v1[1]) {
_sfShowFrame(_rm_dx, _rm_dy, v18);
_sfShowFrame(rm_dx, rm_dy, v18);
} else {
_sync_FrameDropped = 1;
++rm_FrameDropCount;
@@ -905,14 +890,14 @@ LABEL_5:
_SetPalette_1(v1[0], v20);
}
_rm_p = (unsigned char*)v1;
_rm_len = v0;
rm_p = (unsigned char*)v1;
rm_len = v0;
return 0;
case 8:
case 9:
// push data to audio buffers?
if (v1[1] & _rm_track_bit) {
if (v1[1] & rm_track_bit) {
v14 = (unsigned char*)v1 + 6;
if ((v5 >> 16) != 8) {
v14 = nullptr;
@@ -1607,11 +1592,11 @@ static void _palLoadPalette(unsigned char* palette, int a2, int a3)
// 0x4F6240
void _MVE_rmEndMovie()
{
if (_rm_active) {
if (rm_active) {
_syncWait();
_syncRelease();
_MVE_sndReset();
_rm_active = 0;
rm_active = 0;
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ void movieLibSetPaletteEntriesProc(void (*fn)(unsigned char*, int, int));
void _MVE_rmCallbacks(int (*fn)());
void _sub_4F4BB(int a1);
void MVE_rmFrameCounts(int* frame_count_ptr, int* frame_drop_count_ptr);
int _MVE_rmPrepMovie(void* handle, int a2, int a3, char a4);
int MVE_rmPrepMovie(void* handle, int dx, int dy, unsigned char track);
int _MVE_rmStepMovie();
void _MVE_rmEndMovie();
void _MVE_ReleaseMem();