mirror of
https://github.com/krystalgamer/spidey-decomp.git
synced 2024-10-06 18:23:23 +00:00
gave up on square root, continiuing...
This commit is contained in:
parent
b38cdb0e53
commit
aa7eaaf7f5
32
DEFECTS.txt
Normal file
32
DEFECTS.txt
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
M3dMaths_SquareRoot0
|
||||
|
||||
decomp:
|
||||
fild [esp+8+arg_0]
|
||||
fstp [esp+8+X]
|
||||
mov eax, dword ptr [esp+8+X+4]
|
||||
mov ecx, dword ptr [esp+8+X]
|
||||
push eax
|
||||
push ecx ; X
|
||||
call _sqrt
|
||||
add esp, 8
|
||||
call __ftol
|
||||
add esp, 8
|
||||
retn
|
||||
|
||||
|
||||
original:
|
||||
fild dword ptr [esp+8+arg_0]
|
||||
sub esp, 8
|
||||
fstp [esp+10h+var_8] ; DOUBLE not float
|
||||
fld [esp+10h+var_8]
|
||||
fstp [esp+10h+var_10] ; double
|
||||
call _sqrt
|
||||
add esp, 8
|
||||
call __ftol
|
||||
add esp, 8
|
||||
retn
|
||||
|
||||
notes: the function calls are causes by consistent floats, but for some reason the current iteration of the code puts the values in registers. logically it does the same thing so for now i'll just ignore. already spent 12hours+ debugging this shit and can't understand what triggers it. one unexplored avenue is that it's using a fixed point abstraction.
|
||||
it's important to note the last `add esp, 8` is related to the conversion to double in the code that adds on the prologue a `sub esp, 8`. if you do a conversion to float and then to double the code will end up looking "similar" but don't fool yourself the opcodes are different.
|
||||
|
6
m3d.cpp
6
m3d.cpp
@ -1,5 +1,5 @@
|
||||
#include "m3d.h"
|
||||
#include <cmath>
|
||||
#include <math.h>
|
||||
|
||||
int M3dMaths_SquareRoot0(int i){
|
||||
|
||||
@ -11,6 +11,6 @@ int M3dMaths_SquareRoot0(int i){
|
||||
return 0;
|
||||
}
|
||||
|
||||
float tmp = (float)i;
|
||||
return sqrt(tmp);
|
||||
return (int)sqrt(i);
|
||||
}
|
||||
|
||||
|
23
spider.dep
Normal file
23
spider.dep
Normal file
@ -0,0 +1,23 @@
|
||||
# Microsoft Developer Studio Generated Dependency File, included by spider.mak
|
||||
|
||||
.\friction.cpp : \
|
||||
".\friction.h"\
|
||||
|
||||
|
||||
.\m3d.cpp : \
|
||||
".\export.h"\
|
||||
".\m3d.h"\
|
||||
|
||||
|
||||
.\main.cpp : \
|
||||
"..\..\..\..\..\..\program files (x86)\microsoft visual studio\vc98\include\basetsd.h"\
|
||||
".\export.h"\
|
||||
".\friction.h"\
|
||||
".\vector.h"\
|
||||
|
||||
|
||||
.\vector.cpp : \
|
||||
".\export.h"\
|
||||
".\friction.h"\
|
||||
".\vector.h"\
|
||||
|
215
spider.mak
Normal file
215
spider.mak
Normal file
@ -0,0 +1,215 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on spider.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=spider - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to spider - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "spider - Win32 Release" && "$(CFG)" != "spider - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "spider.mak" CFG="spider - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "spider - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "spider - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "spider - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\spider.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\friction.obj"
|
||||
-@erase "$(INTDIR)\m3d.obj"
|
||||
-@erase "$(INTDIR)\main.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vector.obj"
|
||||
-@erase "$(OUTDIR)\spider.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /Op /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\spider.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /fp:strict /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\spider.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\spider.pdb" /machine:I386 /out:"$(OUTDIR)\spider.exe"
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\friction.obj" \
|
||||
"$(INTDIR)\m3d.obj" \
|
||||
"$(INTDIR)\main.obj" \
|
||||
"$(INTDIR)\vector.obj"
|
||||
|
||||
"$(OUTDIR)\spider.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "spider - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\spider.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\friction.obj"
|
||||
-@erase "$(INTDIR)\m3d.obj"
|
||||
-@erase "$(INTDIR)\main.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vector.obj"
|
||||
-@erase "$(OUTDIR)\spider.exe"
|
||||
-@erase "$(OUTDIR)\spider.ilk"
|
||||
-@erase "$(OUTDIR)\spider.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\spider.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\spider.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\spider.pdb" /debug /machine:I386 /out:"$(OUTDIR)\spider.exe" /pdbtype:sept
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\friction.obj" \
|
||||
"$(INTDIR)\m3d.obj" \
|
||||
"$(INTDIR)\main.obj" \
|
||||
"$(INTDIR)\vector.obj"
|
||||
|
||||
"$(OUTDIR)\spider.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("spider.dep")
|
||||
!INCLUDE "spider.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "spider.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "spider - Win32 Release" || "$(CFG)" == "spider - Win32 Debug"
|
||||
SOURCE=.\friction.cpp
|
||||
|
||||
"$(INTDIR)\friction.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\m3d.cpp
|
||||
|
||||
"$(INTDIR)\m3d.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
|
||||
"$(INTDIR)\main.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\vector.cpp
|
||||
|
||||
"$(INTDIR)\vector.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
Loading…
Reference in New Issue
Block a user