redefine vftable as actual member. allocate console for debug purposes

This commit is contained in:
Sydney Biscuit committed 2019-08-18 15:04:12 -07:00
1 parent 7b433f5282
commit 4e5ec98fa6
77 files changed
+348 -280

No files matched your search

+71 -22
View File
@@ -1,33 +1,82 @@
//
// Created by neo on 2019-08-15.
//
#include "pinball.h"
#include "Objlist.h"
//----- (010098D3) --------------------------------------------------------
objlist_class *__thiscall objlist_class::objlist_class(objlist_class *this, int a2, int a3)
//----- (01012E51) --------------------------------------------------------
int __stdcall objlist_add_object(_DWORD *a1, int a2)
{
objlist_class *v3; // esi
int v2; // ecx
v3 = this;
*((_DWORD *)this + 1) = objlist_new(a2);
*(_DWORD *)v3 = a3;
return v3;
v2 = a1[1];
if ( v2 >= *a1 )
return 0;
a1[v2 + 2] = a2;
return ++a1[1];
}
//----- (010098F7) --------------------------------------------------------
void __thiscall objlist_class::Grow(objlist_class *this)
//----- (01012E7A) --------------------------------------------------------
signed int __stdcall objlist_delete_object(int a1, int a2)
{
*((_DWORD *)this + 1) = objlist_grow(*((int **)this + 1), *(_DWORD *)this);
int v2; // edx
int v3; // ecx
_DWORD *v4; // esi
v2 = *(_DWORD *)(a1 + 4);
v3 = v2 - 1;
if ( v2 - 1 < 0 )
return 0;
v4 = (_DWORD *)(a1 + 4 * v3 + 8);
while ( *v4 != a2 )
{
--v3;
--v4;
if ( v3 < 0 )
return 0;
}
*(_DWORD *)(a1 + 4 * v3 + 8) = *(_DWORD *)(a1 + 4 * v2 + 4);
--*(_DWORD *)(a1 + 4);
return 1;
}
//----- (0100ACF3) --------------------------------------------------------
void __thiscall objlist_class::Add(objlist_class *this, void *a2)
//----- (01012EBE) --------------------------------------------------------
_DWORD *__stdcall objlist_new(int a1)
{
objlist_class *v2; // esi
_DWORD *result; // eax
v2 = this;
if ( *(_DWORD *)(*((_DWORD *)this + 1) + 4) == **((_DWORD **)this + 1) )
objlist_class::Grow(this);
objlist_add_object(*((_DWORD **)v2 + 1), (int)a2);
result = (_DWORD *)memoryallocate(4 * a1 + 12);
if ( result )
{
result[1] = 0;
*result = a1;
}
return result;
}
//----- (01012EE8) --------------------------------------------------------
int *__stdcall objlist_grow(int *a1, int a2)
{
int *v2; // esi
int v3; // eax
int *v4; // eax
v2 = a1;
if ( a1 )
{
v3 = a2 + a1[1];
if ( v3 > *a1 )
{
v4 = (int *)memoryrealloc((int)a1, 4 * v3 + 12);
if ( v4 )
{
v2 = v4;
*v4 = a2 + v4[1];
}
}
}
return v2;
}
//----- (01013C6F) --------------------------------------------------------
void __stdcall objlist_destroy(int a1)
{
if ( a1 )
memoryfree(a1);
}