Still searching for bug. Must be some external memory not set

This commit is contained in:
Duncan Frost 2014-05-10 10:12:48 +01:00
parent 1086c4e524
commit 601305a4e3
1 changed files with 90 additions and 51 deletions

141
src/gfx.c
View File

@ -148,67 +148,105 @@ void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, short left, short top, short ri
/* /*
* rct2: 0x67A934 * rct2: 0x67A934
*/ */
void sub_0x67A934(int eax, int ebp, int ebx, int esi, rct_drawpixelinfo *dpi, int x, int y){ void sub_0x67A934(int _eax, int _ebp, int _ebx, int _esi, rct_drawpixelinfo *dpi, int x, int y){
//eax = 3000A, ecx = 9C, edx = 152, ebx = A46798, esp = CFCC8, ebp = DC10005, esi = 0, edi = 9DEA74 //_eax = 3000A, _ecx = 9C, _edx = 152, _ebx = A46798, esp = CFCC8, ebp = DC10005, _esi = 0, _edi = 9DEA74
int ecx = x, edx = y, edi = dpi; int _ecx = x, _edx = y, _edi = dpi;
ebp = dpi; sint16 dx = y, ax = 0, bx = 0, cx = x;
esi = RCT2_GLOBAL(0x9E3D08, uint32); _ebp = dpi;
edi = *((uint32*)dpi); _esi = RCT2_GLOBAL(0x9E3D08, uint32);
edx += RCT2_GLOBAL(0x9E3D12, uint16); _edi = *((uint32*)dpi);//2A18EC
eax = RCT2_GLOBAL(0x9E3D0E, uint16); dx += RCT2_GLOBAL(0x9E3D12, uint16);
ax = RCT2_GLOBAL(0x9E3D0E, uint16);
RCT2_GLOBAL(0xEDF808, uint32) = 0; RCT2_GLOBAL(0xEDF808, uint32) = 0;
RCT2_GLOBAL(0x9ABDAC, uint16) = eax; RCT2_GLOBAL(0x9ABDAC, uint16) = ax;
if (edx > dpi->y) dx -= dpi->y;
if (dx < 0)
{ {
edx -= dpi->y; RCT2_GLOBAL(0x9ABDAC, uint16) += dx;
RCT2_GLOBAL(0x9ABDAC, uint16) += edx;
if (RCT2_GLOBAL(0x9ABDAC, uint16) <= 0)return; if (RCT2_GLOBAL(0x9ABDAC, uint16) <= 0)return;
RCT2_GLOBAL(0xEDF808, uint16) -= edx; RCT2_GLOBAL(0xEDF808, uint16) -= dx;
edx = 0; _edx = 0;
dx = 0;
} }
else{ else{
edx -= dpi->y; ax = dpi->width;
eax = dpi->width; bx = dx;
ebx = edx; ax += dpi->pitch;
eax += dpi->pitch; _edx = dx;
eax *= edx; _eax = ax;
edx = ebx; _eax *= _edx;
edi += eax; _edx = 0;
ax = _eax;
dx = bx;
_edi += _eax;
} }
edx += RCT2_GLOBAL(0x9ABDAC, uint16); dx += RCT2_GLOBAL(0x9ABDAC, uint16);
edx -= dpi->height; dx -= dpi->height;
if (edx > 0){ if (dx > 0){
RCT2_GLOBAL(0x9ABDAC, uint16) -= edx; RCT2_GLOBAL(0x9ABDAC, uint16) -= dx;
if (RCT2_GLOBAL(0x9ABDAC, uint16) <= 0)return; if (RCT2_GLOBAL(0x9ABDAC, uint16) <= 0)return;
} }
eax = RCT2_GLOBAL(0x9E3D0C, uint16); ax = RCT2_GLOBAL(0x9E3D0C, uint16);
RCT2_GLOBAL(0xEDF80C, uint32) = 0; RCT2_GLOBAL(0xEDF80C, uint32) = 0;
ecx += RCT2_GLOBAL(0x9E3D10, uint16); cx += RCT2_GLOBAL(0x9E3D10, uint16);
RCT2_GLOBAL(0x9ABDA8, uint16) = eax; RCT2_GLOBAL(0x9ABDA8, uint16) = ax;
ecx -= dpi->x; cx -= dpi->x;
if (ecx < 0){ if (cx < 0){
RCT2_GLOBAL(0x9ABDA8, uint16) += ecx; RCT2_GLOBAL(0x9ABDA8, uint16) += cx;
if (RCT2_GLOBAL(0x9ABDA8, uint16) <= 0)return; if (RCT2_GLOBAL(0x9ABDA8, uint16) <= 0)return;
RCT2_GLOBAL(0xEDF80C, uint16) -= ecx; RCT2_GLOBAL(0xEDF80C, uint16) -= cx;
ecx = 0; _ecx = 0;
cx = 0;
} }
else{ else{
edi += ecx; _ecx = cx;
_edi += _ecx;
} }
ecx += RCT2_GLOBAL(0x9ABDA8, uint16); cx += RCT2_GLOBAL(0x9ABDA8, uint16);
ecx -= dpi->width; cx -= dpi->width;
if (ecx > 0){ if (cx > 0){
RCT2_GLOBAL(0x9ABDA8, uint16) -= ecx; RCT2_GLOBAL(0x9ABDA8, uint16) -= cx;
if (RCT2_GLOBAL(0x9ABDA8, uint16) <= 0)return; if (RCT2_GLOBAL(0x9ABDA8, uint16) <= 0)return;
} }
eax = dpi->width; ax = dpi->width;
eax += dpi->pitch; ax += dpi->pitch;
RCT2_GLOBAL(0x9ABDB0, uint16) = eax; RCT2_GLOBAL(0x9ABDB0, uint16) = ax;
//ebx esi edi _eax = (_eax & 0xFFFF0000) + ax;
_ebx = (_ebx & 0xFFFF0000) + bx;
_ecx = (_ecx & 0xFFFF0000) + cx;
_edx = (_edx & 0xFFFF0000) + dx;
//_ebx _esi _edi
char* FindThis = "FINDTHISSTRING"; char* FindThis = "FINDTHISSTRING";
//eax 280,ecx FEFC,edx FFFF,ebx A40003,esp CFCC4,ebp 9DEA74,esi 3E1DF13,edi 322076 //_eax 280,_ecx FEFC,_edx FFFF,_ebx A40003,esp CFCC4,ebp 9DEA74,_esi 3E1DF13,_edi 322076
RCT2_CALLPROC_X(0x67A690, eax, ebx, ecx, edx, esi, edi, ebp); _asm{
push eax
push ebx
push ecx
push edx
push edi
push esi
push ebp
push 0x67AA18
push dpi
mov eax, _eax
mov ebx, _ebx
mov ecx, _ecx
mov edx, _edx
mov esi, _esi
mov edi, _edi
mov ebp, _ebp
call [esp+4]
add esp,8
pop ebp
pop esi
pop edi
pop edx
pop ecx
pop ebx
pop eax
}
} }
/** /**
@ -229,7 +267,8 @@ void gfx_draw_sprite(rct_drawpixelinfo *dpi, int image_id, int x, int y)
eax >>= 26; eax >>= 26;
RCT2_GLOBAL(0x00EDF81C, uint32) = image_id & 0xE0000000; RCT2_GLOBAL(0x00EDF81C, uint32) = image_id & 0xE0000000;
eax &= 0x7; eax &= 0x7;
eax = RCT2_GLOBAL(0x009E3CE4 + 4 * eax, uint32);
eax = RCT2_GLOBAL(0x009E3CE4 + eax*4, uint32);//3D91F13 3F71F13 * 2
RCT2_GLOBAL(0x009E3CDC, uint32) = eax; RCT2_GLOBAL(0x009E3CDC, uint32) = eax;
if ((image_id & (1 << 31)) && (image_id & (1 << 29))){ if ((image_id & (1 << 31)) && (image_id & (1 << 29))){
@ -280,12 +319,12 @@ void gfx_draw_sprite(rct_drawpixelinfo *dpi, int image_id, int x, int y)
//long jump into 0x67FAAE //long jump into 0x67FAAE
return; return;
} }
eax = *((uint32*)ebx + 8); eax = *((uint32*)ebx + 2);
ebp = *((uint32*)ebx + 12); ebp = *((uint32*)ebx + 3);
RCT2_GLOBAL(0x9E3D08, uint32) = *((uint32*)ebx); RCT2_GLOBAL(0x9E3D08, uint32) = *((uint32*)ebx);//3F8DF13 3D8DF13
RCT2_GLOBAL(0x9E3D0C, uint32) = *((uint32*)ebx + 4); RCT2_GLOBAL(0x9E3D0C, uint32) = *((uint32*)ebx + 1);//4E003A 4E003A
RCT2_GLOBAL(0x9E3D10, uint32) = *((uint32*)ebx + 8); RCT2_GLOBAL(0x9E3D10, uint32) = *((uint32*)ebx + 2);//3000A * 2
RCT2_GLOBAL(0x9E3D14, uint32) = *((uint32*)ebx + 12); RCT2_GLOBAL(0x9E3D14, uint32) = *((uint32*)ebx + 3);//DC10005 *2
if (RCT2_GLOBAL(0x9E3D14, uint32) & (1 << 2)){ if (RCT2_GLOBAL(0x9E3D14, uint32) & (1 << 2)){
sub_0x67A934(eax, ebp, ebx, esi, dpi, x, y); sub_0x67A934(eax, ebp, ebx, esi, dpi, x, y);
//long jump into 0x67A934 //long jump into 0x67A934