First GNU Release !!

This commit is contained in:
Aaron Robinson 2003-01-26 06:18:56 +00:00
commit 68a328bd3a
43 changed files with 7436 additions and 0 deletions

1
Bin/Debug/dir.txt Normal file
View File

@ -0,0 +1 @@
This directory holds debug mode output binaries.

1
Bin/dir.txt Normal file
View File

@ -0,0 +1 @@
This directory holds release mode output binaries.

157
Cxbe.dsp Normal file
View File

@ -0,0 +1,157 @@
# Microsoft Developer Studio Project File - Name="Cxbe" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=Cxbe - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Cxbe.mak".
!MESSAGE
!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 "Cxbe.mak" CFG="Cxbe - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Cxbe - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "Cxbe - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Cxbe - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Bin"
# PROP Intermediate_Dir "Bin"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "Include" /I "Include/Standard" /I "Include/Standard/Cxbe" /I "Include/Win32/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 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:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 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:console /machine:I386
!ELSEIF "$(CFG)" == "Cxbe - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Bin/Debug"
# PROP Intermediate_Dir "Bin/Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "Include" /I "Include/Standard" /I "Include/Standard/Cxbe" /I "Include/Win32/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 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:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 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:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "Cxbe - Win32 Release"
# Name "Cxbe - Win32 Debug"
# Begin Group "Bin"
# PROP Default_Filter ""
# Begin Group "Debug"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\Bin\Debug\Cxbe.exe
# End Source File
# End Group
# Begin Source File
SOURCE=.\Bin\Cxbe.exe
# End Source File
# End Group
# Begin Group "Doc"
# PROP Default_Filter ""
# End Group
# Begin Group "Include"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\Include\Win32\AlignPosfix1.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\AlignPrefix1.h
# End Source File
# Begin Source File
SOURCE=.\Include\Cxbx.h
# End Source File
# Begin Source File
SOURCE=.\Include\Core\Error.h
# End Source File
# Begin Source File
SOURCE=.\Include\Core\Exe.h
# End Source File
# Begin Source File
SOURCE=.\Include\Core\Xbe.h
# End Source File
# End Group
# Begin Group "Resource"
# PROP Default_Filter ""
# End Group
# Begin Group "Source"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\Source\Core\Error.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Core\Exe.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Standard\Cxbe\Main.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Core\Xbe.cpp
# End Source File
# End Group
# End Target
# End Project

221
Cxbx.dsp Normal file
View File

@ -0,0 +1,221 @@
# Microsoft Developer Studio Project File - Name="Cxbx" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Cxbx - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Cxbx.mak".
!MESSAGE
!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 "Cxbx.mak" CFG="Cxbx - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Cxbx - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Cxbx - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Cxbx - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Bin"
# PROP Intermediate_Dir "Bin"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "Include" /I "Include/Win32/" /I "Include/Win32/Cxbxkrnl" /I "Include/Win32/Cxbx" /I "Resource" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 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 /machine:I386
# ADD LINK32 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 /machine:I386
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Cmds=cd PostBuild upxCxbx.bat
# End Special Build Tool
!ELSEIF "$(CFG)" == "Cxbx - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Bin\Debug"
# PROP Intermediate_Dir "Bin\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "Include" /I "Include/Win32/" /I "Include/Win32/Cxbxkrnl" /I "Include/Win32/Cxbx" /I "Resource" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 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 /debug /machine:I386 /pdbtype:sept
# ADD LINK32 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 /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "Cxbx - Win32 Release"
# Name "Cxbx - Win32 Debug"
# Begin Group "Bin"
# PROP Default_Filter ""
# Begin Group "Debug"
# PROP Default_Filter ""
# End Group
# End Group
# Begin Group "Doc"
# PROP Default_Filter ""
# End Group
# Begin Group "Include"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\Include\Win32\AlignPosfix1.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\AlignPrefix1.h
# End Source File
# Begin Source File
SOURCE=.\Include\Cxbx.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\Cxbx\EmuExe.h
# End Source File
# Begin Source File
SOURCE=.\Include\Core\Error.h
# End Source File
# Begin Source File
SOURCE=.\Include\Core\Exe.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\Kernel.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\Cxbx\Prolog.h
# End Source File
# Begin Source File
SOURCE=.\Resource\resource.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\Cxbx\Wnd.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\Cxbx\WndAbout.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\Cxbx\WndMain.h
# End Source File
# Begin Source File
SOURCE=.\Include\Core\Xbe.h
# End Source File
# End Group
# Begin Group "Resource"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\Resource\Cxbx.ico
# End Source File
# Begin Source File
SOURCE=.\Resource\Cxbx.rc
# End Source File
# Begin Source File
SOURCE=.\Resource\Logo.bmp
# End Source File
# Begin Source File
SOURCE=.\Resource\Splash.bmp
# End Source File
# End Group
# Begin Group "Source"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\Source\Win32\Cxbx\EmuExe.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Core\Error.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Core\Exe.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\Cxbx\Prolog.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\Cxbx\WinMain.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\Cxbx\Wnd.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\Cxbx\WndAbout.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\Cxbx\WndMain.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Core\Xbe.cpp
# End Source File
# End Group
# End Target
# End Project

56
Cxbx.dsw Normal file
View File

@ -0,0 +1,56 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Cxbe"=.\Cxbe.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "Cxbx"=.\Cxbx.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name CxbxKrnl
End Project Dependency
}}}
###############################################################################
Project: "CxbxKrnl"=.\CxbxKrnl.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

131
CxbxKrnl.dsp Normal file
View File

@ -0,0 +1,131 @@
# Microsoft Developer Studio Project File - Name="CxbxKrnl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=CxbxKrnl - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "CxbxKrnl.mak".
!MESSAGE
!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 "CxbxKrnl.mak" CFG="CxbxKrnl - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "CxbxKrnl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "CxbxKrnl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "CxbxKrnl - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "CxbxKrnl___Win32_Release"
# PROP BASE Intermediate_Dir "CxbxKrnl___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Bin"
# PROP Intermediate_Dir "Bin"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CXBXKRNL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "Include" /I "Include/Win32/" /I "Include/Win32/Cxbxkrnl" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CXBXKRNL_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 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 /dll /machine:I386
# ADD LINK32 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 /dll /machine:I386 /out:"Bin/Cxbx.dll"
!ELSEIF "$(CFG)" == "CxbxKrnl - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Bin\Debug"
# PROP Intermediate_Dir "Bin\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CXBXKRNL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "Include" /I "Include/Win32/" /I "Include/Win32/Cxbxkrnl" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CXBXKRNL_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 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 /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 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 /dll /debug /machine:I386 /out:"Bin\Debug/Cxbx.dll" /pdbtype:sept
!ENDIF
# Begin Target
# Name "CxbxKrnl - Win32 Release"
# Name "CxbxKrnl - Win32 Debug"
# Begin Group "Bin"
# PROP Default_Filter ""
# Begin Group "Debug"
# PROP Default_Filter ""
# End Group
# End Group
# Begin Group "Doc"
# PROP Default_Filter ""
# End Group
# Begin Group "Include"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\Kernel.h
# End Source File
# Begin Source File
SOURCE=.\Include\Win32\CxbxKrnl\xntdll.h
# End Source File
# End Group
# Begin Group "Resource"
# PROP Default_Filter ""
# End Group
# Begin Group "Source"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\Source\Win32\CxbxKrnl\Kernel.cpp
# End Source File
# Begin Source File
SOURCE=.\Source\Win32\CxbxKrnl\KernelThunk.cpp
# End Source File
# End Group
# End Target
# End Project

140
Doc/Changelog.txt Normal file
View File

@ -0,0 +1,140 @@
cxbx website: http://www.caustik.com/xbox/
version: 0.6.0 (??/??/03)
--------------------------------
- Released source code under GNU license.
- Beginning HLE process.
- Debugging interface changed. Much cleaner.
version: 0.5.2 (12/14/02)
--------------------------------
- Fixed a bug in section name generation. This might
add some compatibility, not sure yet.
version: 0.5.1 (??/??/??)
--------------------------------
- more .xbe information added to core and xbe dump
version: 0.5.0 (11/16/02)
--------------------------------
- fixed a bug in displaying section digests.
- added conversion from .exe to .xbe!!
- more code cleanup, tiny ui improvements.
version: 0.4.4 (11/01/02)
--------------------------------
- updated .xbe structure for more acccuracy
- added/fixed alot of information in xbe info
dumps. most notably is the TLS information,
which is finally completely correct.
- lots and lots of new kernel function prototypes
and structs/enums are very accurate now.
version: 0.4.3 (10/09/02)
--------------------------------
- added edit menu options to patch for allowing
more than 64mb of ram, and also to toggle between
debug mode / release mode. i also fixed a few
relatively minor gui things, such as suggesting
an appropriate name for saving an .xbe file, instead
of just defaulting to "default.xbe".
version: 0.4.2 (10/07/02)
--------------------------------
- finally got around to adding logo bitmap import
feature. this is pretty damn cool because you
can change that little logo that appears when
you boot your xbox software to whatever you want
it to be. for example, you can modify xbox media
player to display "XBMP" instead of "Microsoft"
version: 0.4.1 (10/04/02)
--------------------------------
- internally alot of little things have changed,
code is organized pretty well now. software run
through the emulator typically safely terminates,
which is pretty damn cool from my perspective.
version: 0.4.0 (BETA) (09/16/02)
--------------------------------
- total code rewrite. most the funcionality
has remained intact with cleaner code UI
and code design.
- logo bitmap is now decoded and displayed
in the main window when you open an .xbe
file. debug output window traces kernel
calls. logo bitmap can be exported to a
bitmap file.
- xbe_info.txt now displays the correctly
decoded kernel thunk table address.
version: 0.3.1 (09/02/2002)
--------------------------------
- significantly decreased file sizes for cxbx.exe
and cxbx_krnl.dll. Also made debug output cleaner.
version: 0.3.0 (08/19/2002)
--------------------------------
- various gui changes, new web site, significant
changes in emulation theory. kernel exports are
now hijacked and interpretted.
version: 0.2.2 (07/24/2002)
---------------------------
- fixed various minor GUI problems
- added kernel thunk address description in GUI
version: 0.2.1 (07/24/2002)
---------------------------
- added "Convert To .EXE" menu option.
- fixed problem where entry point wasn't being detected
correctly when converting to .exe
version: 0.2.0 (07/24/2002)
---------------------------
- drastically changed UI, took out convert to .exe
feature (temporarily).
version: 0.1.3b(07/18/2002)
---------------------------
- oops..fixed an incorrect debug xor value
version: 0.1.3 (07/16/2002)
---------------------------
- .xbe file information dump now shows retail/debug
translated addresses.
version: 0.1.2 (07/16/2002)
---------------------------
- cxbx now dumps .xbe file information in a .txt file.
- new icon ?
- various tiny improvements

1
Doc/Thanks.txt Normal file
View File

@ -0,0 +1 @@
Special Thanks to the authors of UPX file compressor (http://upx.sourceforge.net/).

17
Doc/Todo.txt Normal file
View File

@ -0,0 +1,17 @@
Cxbx Todo:
General Code Cleanup [caustik]
Exe->Xbe should use an "OpenXDK" logo bitmap by default. This can be done
by having a debug version of Cxbx output the necessary raw data. Then, you
just inline it into the code.
Allow a logo bitmap to be added if one does not exist. This may require that
the size of headers be increased. (sizeof_headers).
When loading a file, menus and WM_CLOSE should be disabled and an update
progress should be sent via callback from core.
Xbe::m_Header should be allocated dynamically to make room for huge headers.
TLS needs to be implemented.

84
Include/Core/Error.h Normal file
View File

@ -0,0 +1,84 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Core->Error.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef ERROR_H
#define ERROR_H
// ******************************************************************
// * class : Error
// ******************************************************************
class Error
{
public:
// ******************************************************************
// * Return current error (or zero if there is none)
// ******************************************************************
const char *GetError() const { return m_szError; }
// ******************************************************************
// * True : Error is fatal (class should be dead)
// * False : Error can safely be cleared and class can continue
// ******************************************************************
bool IsFatal() const { return m_bFatal; }
// ******************************************************************
// * True : Error was cleared
// * False : Error is fatal (class should be dead)
// ******************************************************************
bool ClearError();
protected:
// ******************************************************************
// * Protected constructor so this class must be inherited from
// ******************************************************************
Error() : m_szError(0), m_bFatal(false) { }
// ******************************************************************
// * Protected deconstructor
// ******************************************************************
~Error() { delete[] m_szError; }
// ******************************************************************
// * Protected so only derived class may set an error
// ******************************************************************
void SetError(const char *x_szError, bool x_bFatal);
private:
// ******************************************************************
// * Current error information
// ******************************************************************
bool m_bFatal;
char *m_szError;
};
#endif

275
Include/Core/Exe.h Normal file
View File

@ -0,0 +1,275 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Core->Exe.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef EXE_H
#define EXE_H
// ******************************************************************
// * class : Exe
// ******************************************************************
class Exe : public Error
{
public:
// ******************************************************************
// * Construct via Exe file
// ******************************************************************
Exe(const char *x_szFilename);
// ******************************************************************
// * Deconstructor
// ******************************************************************
~Exe();
// ******************************************************************
// * Export to EXE file
// ******************************************************************
void Export(const char *x_szExeFilename);
// ******************************************************************
// * DOSHeader
// ******************************************************************
#include "AlignPrefix1.h"
struct DOSHeader
{
uint16 m_magic; // DOS .EXE magic number
uint16 m_cblp; // byte on last page
uint16 m_cp; // number of pages
uint16 m_crlc; // number of relocations
uint16 m_cparhdr; // size of header (in paragraphs)
uint16 m_minalloc; // minimum extra paragraphs needed
uint16 m_maxalloc; // maximum extra paragraphs needed
uint16 m_ss; // initial SS value (relative)
uint16 m_sp; // initial SP value
uint16 m_csum; // checksum
uint16 m_ip; // initial IP value
uint16 m_cs; // initial CS value (relative)
uint16 m_lfarlc; // file address of relocation table
uint16 m_ovno; // overlay number
uint16 m_res[4]; // reserved words
uint16 m_oemid; // OEM identifier
uint16 m_oeminfo; // OEM information
uint16 m_res2[10]; // reserved words
uint32 m_lfanew; // file address of new .EXE header
}
#include "AlignPosfix1.h"
m_DOSHeader;
// ******************************************************************
// * Header (PE)
// ******************************************************************
#include "AlignPrefix1.h"
struct Header
{
uint32 m_magic; // magic number [should be "PE\0\0"]
uint16 m_machine; // machine type
uint16 m_sections; // number of sections
uint32 m_timedate; // timedate stamp
uint32 m_symbol_table_addr; // symbol table address
uint32 m_symbols; // number of symbols
uint16 m_sizeof_optional_header; // size of optional header
uint16 m_characteristics; // characteristics
}
#include "AlignPosfix1.h"
m_Header;
// ******************************************************************
// * OptionalHeader (PE)
// ******************************************************************
#include "AlignPrefix1.h"
struct OptionalHeader
{
uint16 m_magic; // magic number [should be 0x010B]
uint08 m_linker_version_major; // linker version [major]
uint08 m_linker_version_minor; // linker version [minor]
uint32 m_sizeof_code; // size of code
uint32 m_sizeof_initialized_data; // size of initialized data
uint32 m_sizeof_uninitialized_data; // size of uninitialized data
uint32 m_entry; // address of entry point
uint32 m_code_base; // address of code base
uint32 m_data_base; // address of data base
uint32 m_image_base; // address of image base
uint32 m_section_alignment; // section alignment
uint32 m_file_alignment; // file alignment
uint16 m_os_version_major; // operating system version [major]
uint16 m_os_version_minor; // operating system version [minor]
uint16 m_image_version_major; // image version [major]
uint16 m_image_version_minor; // image version [minor]
uint16 m_subsystem_version_major; // subsystem version [major]
uint16 m_subsystem_version_minor; // subsystem version [minor]
uint32 m_win32_version; // win32 version
uint32 m_sizeof_image; // size of image
uint32 m_sizeof_headers; // size of headers
uint32 m_checksum; // checksum
uint16 m_subsystem; // subsystem
uint16 m_dll_characteristics; // dll characteristics
uint32 m_sizeof_stack_reserve; // size of stack reserve
uint32 m_sizeof_stack_commit; // size of stack commit
uint32 m_sizeof_heap_reserve; // size of heap reserve
uint32 m_sizeof_heap_commit; // size of heap commit
uint32 m_loader_flags; // loader flags
uint32 m_data_directories; // data directories
struct image_data_directory // image data directory
{
uint32 m_virtual_addr; // virtual address
uint32 m_size; // size
}
m_image_data_directory[0x10];
}
#include "AlignPosfix1.h"
m_OptionalHeader;
// ******************************************************************
// * PE Section Header
// ******************************************************************
#include "AlignPrefix1.h"
struct SectionHeader
{
char m_name[8]; // name of section
uint32 m_virtual_size; // virtual size of segment
uint32 m_virtual_addr; // virtual address of segment
uint32 m_sizeof_raw; // size of raw data
uint32 m_raw_addr; // address of raw data
uint32 m_relocations_addr; // address of relocations
uint32 m_linenumbers_addr; // address of line numbers
uint16 m_relocations; // number of relocations
uint16 m_linenumbers; // number of linenumbers
uint32 m_characteristics; // characteristics for this segment
}
#include "AlignPosfix1.h"
*m_SectionHeader;
// ******************************************************************
// * array of section data
// ******************************************************************
uint08 **m_bzSection;
protected:
// ******************************************************************
// * Protected Default Constructor
// ******************************************************************
Exe() {};
// ******************************************************************
// * constructor initialization
// ******************************************************************
void ConstructorInit();
// ******************************************************************
// * return a modifiable pointer inside this structure that
// * corresponds to a virtual address
// ******************************************************************
uint08 *GetAddr(uint32 x_dwVirtualAddress);
};
// ******************************************************************
// * PE File/Segment alignments: these must always both equal 0x0020
// ******************************************************************
static uint32 PE_FILE_ALIGN (0x0020);
static uint32 PE_SEGM_ALIGN (0x0020);
// ******************************************************************
// * Section Characeristics
// ******************************************************************
#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code.
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data.
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data.
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded.
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable.
#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable.
#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable.
#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable.
#define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable.
#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable.
// ******************************************************************
// * Based relocation types
// ******************************************************************
#define IMAGE_REL_BASED_ABSOLUTE 0
#define IMAGE_REL_BASED_HIGH 1
#define IMAGE_REL_BASED_LOW 2
#define IMAGE_REL_BASED_HIGHLOW 3
#define IMAGE_REL_BASED_HIGHADJ 4
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
#define IMAGE_REL_BASED_MIPS_JMPADDR16 9
#define IMAGE_REL_BASED_IA64_IMM64 9
#define IMAGE_REL_BASED_DIR64 10
// ******************************************************************
// * Machine type(s)
// ******************************************************************
#define IMAGE_FILE_MACHINE_I386 0x014c // Intel 386.
// ******************************************************************
// * Subsystems
// ******************************************************************
#define IMAGE_SUBSYSTEM_UNKNOWN 0
#define IMAGE_SUBSYSTEM_NATIVE 1
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
#define IMAGE_SUBSYSTEM_OS2_CUI 5
#define IMAGE_SUBSYSTEM_POSIX_CUI 7
#define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
// ******************************************************************
// * DOS stub
// ******************************************************************
static uint08 bzDOSStub[] =
{
0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00,
0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xB8, 0x00, 0x00, 0x00,
0x0E, 0x1F, 0xBA, 0x0E, 0x00, 0xB4, 0x09, 0xCD,
0x21, 0xB8, 0x01, 0x4C, 0xCD, 0x21, 0x54, 0x68,
0x69, 0x73, 0x20, 0x70, 0x72, 0x6F, 0x67, 0x72,
0x61, 0x6D, 0x20, 0x63, 0x61, 0x6E, 0x6E, 0x6F,
0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6E,
0x20, 0x69, 0x6E, 0x20, 0x44, 0x4F, 0x53, 0x20,
0x6D, 0x6F, 0x64, 0x65, 0x2E, 0x0D, 0x0D, 0x0A,
0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x85, 0xE3, 0xB8, 0xDB, 0xC1, 0x82, 0xD6, 0x88,
0xC1, 0x82, 0xD6, 0x88, 0xC1, 0x82, 0xD6, 0x88,
0xC1, 0x82, 0xD7, 0x88, 0xC3, 0x82, 0xD6, 0x88,
0x3E, 0xA2, 0xD2, 0x88, 0xC2, 0x82, 0xD6, 0x88,
0x95, 0xA1, 0xE7, 0x88, 0xC0, 0x82, 0xD6, 0x88,
0x52, 0x69, 0x63, 0x68, 0xC1, 0x82, 0xD6, 0x88,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
#endif

324
Include/Core/Xbe.h Normal file
View File

@ -0,0 +1,324 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Core->Xbe.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef XBE_H
#define XBE_H
#include <stdlib.h>
// ******************************************************************
// * class : Xbe
// ******************************************************************
class Xbe : public Error
{
public:
// ******************************************************************
// * Construct via Xbe file
// ******************************************************************
Xbe(const char *x_szFilename);
// ******************************************************************
// * Construct via Exe file object
// ******************************************************************
Xbe(class Exe *x_Exe, const char *x_szTitle, bool x_bRetail);
// ******************************************************************
// * Deconstructor
// ******************************************************************
~Xbe();
// ******************************************************************
// * Export to XBE file
// ******************************************************************
void Export(const char *x_szXbeFilename);
// ******************************************************************
// * Dump XBE information to text file
// ******************************************************************
void DumpInformation(const char *x_szTxtFilename);
// ******************************************************************
// * Import logo bitmap from raw monochrome data
// ******************************************************************
void ImportLogoBitmap(const uint08 x_Gray[100*17]);
// ******************************************************************
// * Export logo bitmap to raw monochrome data
// ******************************************************************
void ExportLogoBitmap(uint08 x_Gray[100*17]);
// ******************************************************************
// * XBE header
// ******************************************************************
#include "AlignPrefix1.h"
struct Header
{
uint32 dwMagic; // magic number [should be "XBEH"]
uint08 pbDigitalSignature[256]; // digital signature
uint32 dwBaseAddr; // base address
uint32 dwSizeofHeaders; // size of headers
uint32 dwSizeofImage; // size of image
uint32 dwSizeofImageHeader; // size of image header
uint32 dwTimeDate; // timedate stamp
uint32 dwCertificateAddr; // certificate address
uint32 dwSections; // number of sections
uint32 dwSectionHeadersAddr; // section headers address
struct InitFlags
{
uint32 bMountUtilityDrive : 1; // mount utility drive flag
uint32 bFormatUtilityDrive : 1; // format utility drive flag
uint32 bLimit64MB : 1; // limit development kit run time memory to 64mb flag
uint32 bDontSetupHarddisk : 1; // don't setup hard disk flag
uint32 Unused : 4; // unused (or unknown)
uint32 Unused_b1 : 8; // unused (or unknown)
uint32 Unused_b2 : 8; // unused (or unknown)
uint32 Unused_b3 : 8; // unused (or unknown)
}
dwInitFlags;
uint32 dwEntryAddr; // entry point address
uint32 dwTLSAddr; // thread local storage directory address
uint32 dwPeStackCommit; // size of stack commit
uint32 dwPeHeapReserve; // size of heap reserve
uint32 dwPeHeapCommit; // size of heap commit
uint32 dwPeBaseAddr; // original base address
uint32 dwPeSizeofImage; // size of original image
uint32 dwPeChecksum; // original checksum
uint32 dwPeTimeDate; // original timedate stamp
uint32 dwDebugPathnameAddr; // debug pathname address
uint32 dwDebugFilenameAddr; // debug filename address
uint32 dwDebugUnicodeFilenameAddr; // debug unicode filename address
uint32 dwKernelImageThunkAddr; // kernel image thunk address
uint32 dwNonKernelImportDirAddr; // non kernel import directory address
uint32 dwLibraryVersions; // number of library versions
uint32 dwLibraryVersionsAddr; // library versions address
uint32 dwKernelLibraryVersionAddr; // kernel library version address
uint32 dwXAPILibraryVersionAddr; // xapi library version address
uint32 dwLogoBitmapAddr; // logo bitmap address
uint32 dwSizeofLogoBitmap; // logo bitmap size
}
#include "AlignPosfix1.h"
m_Header;
// ******************************************************************
// * XBE header extra bytes (used to preserve unknown data)
// ******************************************************************
char *m_HeaderEx;
// ******************************************************************
// * XBE certificate
// ******************************************************************
#include "AlignPrefix1.h"
struct Certificate
{
uint32 dwSize; // size of certificate
uint32 dwTimeDate; // timedate stamp
uint32 dwTitleId; // title id
wchar_t wszTitleName[40]; // title name (unicode)
uint32 dwAlternateTitleId[0x10]; // alternate title ids
uint32 dwAllowedMedia; // allowed media types
uint32 dwGameRegion; // game region
uint32 dwGameRatings; // game ratings
uint32 dwDiskNumber; // disk number
uint32 dwVersion; // version
uint08 bzLanKey[16]; // lan key
uint08 bzSignatureKey[16]; // signature key
uint08 bzTitleAlternateSignatureKey[16][16]; // alternate signature keys
}
#include "AlignPosfix1.h"
m_Certificate;
// ******************************************************************
// * XBE section header
// ******************************************************************
#include "AlignPrefix1.h"
struct SectionHeader
{
struct _Flags
{
uint32 bWritable : 1; // writable flag
uint32 bPreload : 1; // preload flag
uint32 bExecutable : 1; // executable flag
uint32 bInsertedFile : 1; // inserted file flag
uint32 bHeadPageRO : 1; // head page read only flag
uint32 bTailPageRO : 1; // tail page read only flag
uint32 Unused_a1 : 1; // unused (or unknown)
uint32 Unused_a2 : 1; // unused (or unknown)
uint32 Unused_b1 : 8; // unused (or unknown)
uint32 Unused_b2 : 8; // unused (or unknown)
uint32 Unused_b3 : 8; // unused (or unknown)
}
dwFlags;
uint32 dwVirtualAddr; // virtual address
uint32 dwVirtualSize; // virtual size
uint32 dwRawAddr; // file offset to raw data
uint32 dwSizeofRaw; // size of raw data
uint32 dwSectionNameAddr; // section name addr
uint32 dwSectionRefCount; // section reference count
uint32 dwHeadSharedRefCountAddr; // head shared page reference count address
uint32 dwTailSharedRefCountAddr; // tail shared page reference count address
uint08 bzSectionDigest[20]; // section digest
}
#include "AlignPosfix1.h"
*m_SectionHeader;
// ******************************************************************
// * XBE library versions
// ******************************************************************
#include "AlignPrefix1.h"
struct LibraryVersion
{
char szName[8]; // library name
uint16 wMajorVersion; // major version
uint16 wMinorVersion; // minor version
uint16 wBuildVersion; // build version
struct Flags
{
uint16 QFEVersion : 13; // QFE Version
uint16 Approved : 2; // Approved? (0:no, 1:possibly, 2:yes)
uint16 bDebugBuild : 1; // Is this a debug build?
}
dwFlags;
}
#include "AlignPosfix1.h"
*m_LibraryVersion, *m_KernelLibraryVersion, *m_XAPILibraryVersion;
// ******************************************************************
// * XBE thread local storage
// ******************************************************************
#include "AlignPrefix1.h"
struct TLS
{
uint32 dwDataStartAddr; // raw start address
uint32 dwDataEndAddr; // raw end address
uint32 dwTLSIndexAddr; // tls index address
uint32 dwTLSCallbackAddr; // tls callback address
uint32 dwSizeofZeroFill; // size of zero fill
uint32 dwCharacteristics; // characteristics
}
#include "AlignPosfix1.h"
*m_TLS;
// ******************************************************************
// * XBE section names, each 8 bytes max and null terminated
// ******************************************************************
char (*m_szSectionName)[9];
// ******************************************************************
// * XBE sections
// ******************************************************************
uint08 **m_bzSection;
// ******************************************************************
// * XBE ascii title, translated from certificate title
// ******************************************************************
char m_szAsciiTitle[40];
private:
// ******************************************************************
// * constructor initialization
// ******************************************************************
void ConstructorInit();
// ******************************************************************
// * return a modifiable pointer inside this structure that
// * corresponds to a virtual address
// ******************************************************************
uint08 *GetAddr(uint32 x_dwVirtualAddress);
// ******************************************************************
// * return a modifiable pointer to logo bitmap data
// ******************************************************************
uint08 *GetLogoBitmap(uint32 x_dwSize);
// ******************************************************************
// * used to encode / decode logo bitmap data
// ******************************************************************
union LogoRLE
{
struct Eight
{
uint32 bType1 : 1;
uint32 Len : 3;
uint32 Data : 4;
}
m_Eight;
struct Sixteen
{
uint32 bType1 : 1;
uint32 bType2 : 1;
uint32 Len : 10;
uint32 Data : 4;
}
m_Sixteen;
};
};
// ******************************************************************
// * Debug / Retail XOR Keys
// ******************************************************************
const uint32 XOR_EP_DEBUG = 0x94859D4B; // Entry Point (Debug)
const uint32 XOR_EP_RETAIL = 0xA8FC57AB; // Entry Point (Retail)
const uint32 XOR_KT_DEBUG = 0xEFB1F152; // Kernel Thunk (Debug)
const uint32 XOR_KT_RETAIL = 0x5B6D40B6; // Kernel Thunk (Retail)
// ******************************************************************
// * Game region flags for XBE certificate
// ******************************************************************
const uint32 XBEIMAGE_GAME_REGION_NA = 0x00000001;
const uint32 XBEIMAGE_GAME_REGION_JAPAN = 0x00000002;
const uint32 XBEIMAGE_GAME_REGION_RESTOFWORLD = 0x00000004;
const uint32 XBEIMAGE_GAME_REGION_MANUFACTURING = 0x80000000;
// ******************************************************************
// * Media type flags for XBE certificate
// ******************************************************************
const uint32 XBEIMAGE_MEDIA_TYPE_HARD_DISK = 0x00000001;
const uint32 XBEIMAGE_MEDIA_TYPE_DVD_X2 = 0x00000002;
const uint32 XBEIMAGE_MEDIA_TYPE_DVD_CD = 0x00000004;
const uint32 XBEIMAGE_MEDIA_TYPE_CD = 0x00000008;
const uint32 XBEIMAGE_MEDIA_TYPE_DVD_5_RO = 0x00000010;
const uint32 XBEIMAGE_MEDIA_TYPE_DVD_9_RO = 0x00000020;
const uint32 XBEIMAGE_MEDIA_TYPE_DVD_5_RW = 0x00000040;
const uint32 XBEIMAGE_MEDIA_TYPE_DVD_9_RW = 0x00000080;
const uint32 XBEIMAGE_MEDIA_TYPE_DONGLE = 0x00000100;
const uint32 XBEIMAGE_MEDIA_TYPE_MEDIA_BOARD = 0x00000200;
const uint32 XBEIMAGE_MEDIA_TYPE_NONSECURE_HARD_DISK = 0x40000000;
const uint32 XBEIMAGE_MEDIA_TYPE_NONSECURE_MODE = 0x80000000;
const uint32 XBEIMAGE_MEDIA_TYPE_MEDIA_MASK = 0x00FFFFFF;
#endif

75
Include/Cxbx.h Normal file
View File

@ -0,0 +1,75 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Cxbx.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef CXBX_H
#define CXBX_H
// ******************************************************************
// * Caustik's favorite typedefs
// ******************************************************************
typedef signed int sint;
typedef unsigned int uint;
typedef char int08;
typedef short int16;
typedef long int32;
typedef unsigned char uint08;
typedef unsigned short uint16;
typedef unsigned long uint32;
typedef signed char sint08;
typedef signed short sint16;
typedef signed long sint32;
// ******************************************************************
// * Version Information
// ******************************************************************
#define CXBX_VERSION "0.6.0-Pre9"
// ******************************************************************
// * func : RoundUp
// ******************************************************************
static uint32 RoundUp(uint32 x_dwValue, uint32 x_dwMult)
{
if(x_dwMult == 0)
return x_dwValue;
return x_dwValue - (x_dwValue-1)%x_dwMult + (x_dwMult - 1);
}
// ******************************************************************
// * Core Components
// ******************************************************************
#include "Core/Error.h"
#include "Core/Exe.h"
#include "Core/Xbe.h"
#endif

View File

@ -0,0 +1,42 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Linux->AlignPosfix1.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef ALIGNPOSFIX1_H
#define ALIGNPOSFIX1_H
// ******************************************************************
// * 1-byte structure alignment
// ******************************************************************
__attribute((packed))
#endif

View File

@ -0,0 +1,41 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Linux->AlignPrefix1.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef ALIGNPREFIX1_H
#define ALIGNPREFIX1_H
// ******************************************************************
// * For linux, we don't have any alignment prefix (just posfix)
// ******************************************************************
#endif

View File

@ -0,0 +1,42 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->AlignPosfix1.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef ALIGNPOSFIX1_H
#define ALIGNPOSFIX1_H
// ******************************************************************
// * Turn off 1-byte structure alignment
// ******************************************************************
#pragma pack()
#endif

View File

@ -0,0 +1,47 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->AlignPrefix1.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef ALIGNPREFIX1_H
#define ALIGNPREFIX1_H
// ******************************************************************
// * Turn on 1-byte structure alignment
// ******************************************************************
#pragma pack(1)
// ******************************************************************
// * Tell the compiler not to complain about this *odd* circumstance
// ******************************************************************
#pragma warning(disable:4103)
#endif

View File

@ -0,0 +1,51 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->EmuExe.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef EMUEXE_H
#define EMUEXE_H
#include "Cxbx.h"
// ******************************************************************
// * class : EmuExe
// ******************************************************************
class EmuExe : public Exe
{
public:
// ******************************************************************
// * Construct via Xbe file object
// ******************************************************************
EmuExe(class Xbe *x_Xbe, uint32 x_debug_console);
};
#endif

View File

@ -0,0 +1,42 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->Prolog.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef PROLOG_H
#define PROLOG_H
// ******************************************************************
// * func : Prolog
// ******************************************************************
extern uint08 Prolog[];
#endif

72
Include/Win32/Cxbx/Wnd.h Normal file
View File

@ -0,0 +1,72 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->Wnd.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef WND_H
#define WND_H
#include <windows.h>
// ******************************************************************
// * class : Wnd
// ******************************************************************
class Wnd : public Error
{
public:
Wnd(HINSTANCE x_hInstance);
~Wnd();
bool ProcessMessages();
static LRESULT CALLBACK WndProcForward(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
virtual LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
HWND GetHwnd() { return m_hwnd; }
protected:
HINSTANCE m_hInstance;
ATOM m_class;
HWND m_hwnd;
const char *m_classname;
const char *m_wndname;
UINT m_clsstyle;
DWORD m_wndstyle;
int m_x, m_y, m_w, m_h;
HWND m_parent;
HBRUSH m_background;
bool m_initialized;
private:
};
#endif

View File

@ -0,0 +1,56 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->WndAbout.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef WNDABOUT_H
#define WNDABOUT_H
#include "Wnd.h"
// ******************************************************************
// * class : WndAbout
// ******************************************************************
class WndAbout : public Wnd
{
public:
WndAbout(HINSTANCE x_hInstance, HWND x_parent);
~WndAbout();
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
HFONT m_hFont;
};
#endif

View File

@ -0,0 +1,86 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->WndMain.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef WNDMAIN_H
#define WNDMAIN_H
#include "Wnd.h"
// ******************************************************************
// * class : WndMain
// ******************************************************************
class WndMain : public Wnd
{
public:
WndMain(HINSTANCE x_hInstance);
~WndMain();
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
void SuggestFilename(const char *x_orig_filename, char *x_filename, char x_extension[4]);
void XbeLoaded(); // after an xbe is loaded, some stuff needs to update
void LoadLogo(); // refresh the logo in the main window
bool ConvertToExe();
void SaveXbe(const char *x_filename);
void SaveXbeAs();
void CloseXbe();
HDC m_back_dc;
HDC m_logo_dc;
HBITMAP m_orig_bmp;
HBITMAP m_orig_logo;
HBITMAP m_back_bmp;
HBITMAP m_logo_bmp;
Xbe *m_xbe;
Exe *m_exe;
char *m_xbe_filename;
char *m_exe_filename;
bool m_xbe_changed;
bool m_exe_changed;
uint32 m_krnl_debug;
};
#endif

View File

@ -0,0 +1,83 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->CxbxKrnl->Kernel.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef KERNEL_H
#define KERNEL_H
// ******************************************************************
// * namespace used to avoid collisions with ntdll and win32
// ******************************************************************
namespace xboxkrnl
{
#include <xboxkrnl/xboxkrnl.h>
};
#if defined(__cplusplus)
extern "C"
{
#endif
// ******************************************************************
// * cxbxkrnl exports, others import
// ******************************************************************
#ifndef CXBXKRNL_INTERNAL
#define CXBXKRNL_API DECLSPEC_IMPORT
#else
#define CXBXKRNL_API DECLSPEC_EXPORT
#endif
// ******************************************************************
// * data: KernelThunkTable
// ******************************************************************
extern CXBXKRNL_API uint32 KernelThunkTable[367];
// ******************************************************************
// * func: EmuXInit
// ******************************************************************
CXBXKRNL_API void NTAPI EmuXInit(uint32 DebugConsole, uint08 *XBEHeader, uint32 XBEHeaderSize, void (*Entry)());
// ******************************************************************
// * func: EmuXDummy
// ******************************************************************
CXBXKRNL_API void NTAPI EmuXDummy();
// ******************************************************************
// * func: EmuXPanic
// ******************************************************************
CXBXKRNL_API void NTAPI EmuXPanic();
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -0,0 +1,149 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->CxbxKrnl->xntdll.h
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef XNTDLL_H
#define XNTDLL_H
#if defined(__cplusplus)
extern "C"
{
#endif
// ******************************************************************
// * dll import/export
// ******************************************************************
#define DECLSPEC_IMPORT __declspec(dllimport)
#define DECLSPEC_EXPORT __declspec(dllexport)
// ******************************************************************
// * cxbx_krnl exports, others import
// ******************************************************************
#define NTSYSAPI DECLSPEC_IMPORT
// ******************************************************************
// * Basic types
// ******************************************************************
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
typedef unsigned char UCHAR;
typedef unsigned char BYTE;
typedef unsigned char BOOLEAN;
typedef unsigned short USHORT;
typedef unsigned short WORD;
typedef unsigned long ULONG;
typedef unsigned long DWORD;
typedef unsigned long SIZE_T, *PSIZE_T;
typedef unsigned long ACCESS_MASK;
typedef unsigned long PHYSICAL_ADDRESS;
typedef long INT_PTR;
// ******************************************************************
// * Pointer types
// ******************************************************************
typedef CHAR *PCHAR;
typedef CHAR *PCSZ;
typedef BYTE *PBYTE;
typedef BOOLEAN *PBOOLEAN;
typedef UCHAR *PUCHAR;
typedef USHORT *PUSHORT;
typedef ULONG *PULONG;
typedef ACCESS_MASK *PACCESS_MASK;
typedef LONG *LONG_PTR;
typedef INT_PTR *PINT_PTR;
typedef void VOID;
typedef VOID *PVOID;
typedef void *HANDLE;
typedef HANDLE *PHANDLE;
// ******************************************************************
// * NTSTATUS
// ******************************************************************
typedef long NTSTATUS;
typedef unsigned __int64 ULONGLONG;
// ******************************************************************
// * LDT_ENTRY
// ******************************************************************
typedef struct _LDT_ENTRY
{
WORD LimitLow;
WORD BaseLow;
union
{
struct
{
BYTE BaseMid;
BYTE Flags1; // Declare as bytes to avoid alignment
BYTE Flags2; // Problems.
BYTE BaseHi;
}
Bytes;
struct
{
DWORD BaseMid : 8;
DWORD Type : 5;
DWORD Dpl : 2;
DWORD Pres : 1;
DWORD LimitHi : 4;
DWORD Sys : 1;
DWORD Reserved_0 : 1;
DWORD Default_Big : 1;
DWORD Granularity : 1;
DWORD BaseHi : 8;
}
Bits;
}
HighWord;
}
LDT_ENTRY, *PLDT_ENTRY;
// ******************************************************************
// * NtSetLdtEntries
// ******************************************************************
NTSYSAPI NTSTATUS NTAPI NtSetLdtEntries
(
IN USHORT Selector1,
IN LDT_ENTRY Descriptor1,
IN USHORT Selector2,
IN LDT_ENTRY Descriptor2
);
#if defined(__cplusplus)
}
#endif
#endif

68
Makefile Normal file
View File

@ -0,0 +1,68 @@
# ******************************************************************
# *
# * .,-::::: .,:: .::::::::. .,:: .:
# * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
# * [[[ '[[,,[[' [[[__[[\. '[[,,[['
# * $$$ Y$$$P $$""""Y$$ Y$$$P
# * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
# * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
# *
# * Cxbx->Makefile
# *
# * This file is part of the Cxbx project.
# *
# * Cxbx and Cxbe are free software; you can redistribute them
# * and/or modify them under the terms of the GNU General Public
# * License as published by the Free Software Foundation; either
# * version 2 of the license, or (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have recieved a copy of the GNU General Public License
# * along with this program; see the file COPYING.
# * If not, write to the Free Software Foundation, Inc.,
# * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
# *
# * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
# *
# * All rights reserved
# *
# ******************************************************************
# * File Authors: Aaron Robinson, Edgar Hucek
# ******************************************************************
CC = g++
CFLAGS = -g -O2 -IInclude -IInclude/Standard -IInclude/Standard/Cxbe -IInclude/Linux/
OBJCOPY = objcopy
GCC295 = cpp0-2.95
#LDFLAGS = -s -S -T ldscript.ld
OBJECTS = Source/Core/Error.o \
Source/Core/Exe.o \
Source/Core/Xbe.o \
Source/Standard/Cxbe/Main.o
RESOURCES =
# target:
all : cxbe
clean :
rm -rf *.o *~ core *.core ${OBJECTS} ${RESOURCES}
rm -rf *.o *~ core *.core ${OBJECTS} ${RESOURCES} Bin/cxbe Bin/cxbe.exe
cxbe : ${OBJECTS} ${RESOURCES}
${CC} -o Bin/$@ ${OBJECTS} ${RESOURCES} ${LDFLAGS-XBE}
### rules:
%.o : %.cpp
${CC} ${CFLAGS} -o $@ -c $<
%.o : %.c
${CC} ${CFLAGS} -o $@ -c $<
%.o : %.S
${CC} -DASSEMBLER ${CFLAGS} -o $@ -c $<

2
PostBuild/upxCxbx.bat Normal file
View File

@ -0,0 +1,2 @@
upx -9 ../Bin/Cxbx.exe
upx -9 ../Bin/Cxbx.dll

BIN
Resource/Cxbx.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

137
Resource/Cxbx.rc Normal file
View File

@ -0,0 +1,137 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_CXBX ICON DISCARDABLE "Cxbx.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_SPLASH BITMAP DISCARDABLE "Splash.bmp"
IDB_LOGO BITMAP DISCARDABLE "Logo.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINMENU MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open Xbe...", ID_FILE_OPEN_XBE
MENUITEM "&Close xbe", ID_FILE_CLOSE_XBE, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Save Xbe", ID_FILE_SAVEXBEFILE, GRAYED
MENUITEM "Save Xbe &As...", ID_FILE_SAVEXBEFILEAS
, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Import Exe...", ID_FILE_IMPORTFROMEXE
MENUITEM "&Export Exe...", ID_FILE_EXPORTTOEXE, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "&Edit"
BEGIN
POPUP "Logo &Bitmap", GRAYED
BEGIN
MENUITEM "&Import...", ID_EDIT_LOGOBITMAP_IMPORT
MENUITEM "&Export...", ID_EDIT_LOGOBITMAP_EXPORT
END
POPUP "&Patch", GRAYED
BEGIN
MENUITEM "&Allow >64 MB", ID_EDIT_PATCH_ALLOW64MB
MENUITEM "Debug Mode", ID_EDIT_PATCH_DEBUGMODE
END
MENUITEM SEPARATOR
MENUITEM "Extract &Xbe Info...", ID_EDIT_EXTRACTXBEINFO
, GRAYED
END
POPUP "&View"
BEGIN
MENUITEM "&Debug Console (GUI)", ID_VIEW_DEBUGCONSOLE
MENUITEM "Debug Console (Kernel)", ID_VIEW_KERNELDEBUGCONSOLE
END
POPUP "E&mulation"
BEGIN
MENUITEM "&Start", ID_EMULATION_START, GRAYED
END
POPUP "&Help"
BEGIN
MENUITEM "&Caustik's XBox Hacking Page...", ID_HELP_HOMEPAGE
MENUITEM SEPARATOR
MENUITEM "&About", ID_HELP_ABOUT
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

BIN
Resource/Logo.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

BIN
Resource/Splash.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

36
Resource/resource.h Normal file
View File

@ -0,0 +1,36 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Cxbx.rc
//
#define IDI_CXBX 101
#define IDB_SPLASH 102
#define IDR_MAINMENU 103
#define IDB_LOGO 106
#define ID_FILE_EXIT 40005
#define ID_VIEW_DEBUGCONSOLE 40007
#define ID_HELP_ABOUT 40008
#define ID_EMULATION_START 40009
#define ID_FILE_EXPORTTOEXE 40011
#define ID_FILE_OPEN_XBE 40013
#define ID_FILE_CLOSE_XBE 40014
#define ID_EDIT_EXTRACTXBEINFO 40017
#define ID_HELP_HOMEPAGE 40019
#define ID_FILE_SAVEXBEFILE 40021
#define ID_FILE_SAVEXBEFILEAS 40022
#define ID_EDIT_LOGOBITMAP_EXPORT 40025
#define ID_EDIT_LOGOBITMAP_IMPORT 40026
#define ID_EDIT_PATCH_ALLOW64MB 40027
#define ID_EDIT_PATCH_DEBUGMODE 40031
#define ID_FILE_IMPORTFROMEXE 40032
#define ID_VIEW_KERNELDEBUGCONSOLE 40033
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40034
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 103
#endif
#endif

67
Source/Core/Error.cpp Normal file
View File

@ -0,0 +1,67 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Core->Error.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
#include <string.h>
// ******************************************************************
// * func : ClearError
// ******************************************************************
bool Error::ClearError()
{
if(m_bFatal)
return false;
delete[] m_szError;
m_szError = 0;
m_bFatal = false;
return true;
}
// ******************************************************************
// * func : SetError
// ******************************************************************
void Error::SetError(const char *x_szError, bool x_bFatal)
{
if(m_szError == 0)
m_szError = new char[256];
strcpy(m_szError, x_szError);
m_bFatal = x_bFatal;
return;
}

310
Source/Core/Exe.cpp Normal file
View File

@ -0,0 +1,310 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Core->Exe.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
#include <memory.h>
#include <stdio.h>
// ******************************************************************
// * constructor
// ******************************************************************
Exe::Exe(const char *x_szFilename)
{
ConstructorInit();
FILE *ExeFile = fopen(x_szFilename, "rb");
// ******************************************************************
// * verify exe file was opened
// ******************************************************************
if(ExeFile == 0)
{
SetError("could not open .exe file.", true);
return;
}
// ******************************************************************
// * ignore dos stub (if it exists)
// ******************************************************************
{
if(fread(&m_DOSHeader.m_magic, sizeof(m_DOSHeader.m_magic), 1, ExeFile) != 1)
{
SetError("unexpected read error while reading magic number", true);
goto cleanup;
}
if(m_DOSHeader.m_magic == *(uint16*)"MZ")
{
if(fread(&m_DOSHeader.m_cblp, sizeof(m_DOSHeader)-2, 1, ExeFile) != 1)
{
SetError("unexpected read error while reading dos header", true);
goto cleanup;
}
fseek(ExeFile, m_DOSHeader.m_lfanew, SEEK_SET);
}
}
// ******************************************************************
// * read pe header
// ******************************************************************
{
if(fread(&m_Header, sizeof(m_Header), 1, ExeFile) != 1)
{
SetError("unexpected read error while reading pe header", true);
goto cleanup;
}
if(m_Header.m_magic != *(uint32*)"PE\0\0")
{
SetError("invalid file, could not locate PE header", true);
goto cleanup;
}
}
// ******************************************************************
// * read optional header
// ******************************************************************
{
if(fread(&m_OptionalHeader, sizeof(m_OptionalHeader), 1, ExeFile) != 1)
{
SetError("unexpected read error while reading optional header", true);
goto cleanup;
}
if(m_OptionalHeader.m_magic != 0x010B)
{
SetError("invalid file, could not locate optional header", true);
goto cleanup;
}
}
// ******************************************************************
// * read section headers
// ******************************************************************
{
m_SectionHeader = new SectionHeader[m_Header.m_sections];
for(uint32 v=0;v<m_Header.m_sections;v++)
{
if(fread(&m_SectionHeader[v], sizeof(SectionHeader), 1, ExeFile) != 1)
{
char buffer[255];
sprintf(buffer, "could not read pe section header %d (%Xh)", v, v);
SetError(buffer, true);
goto cleanup;
}
}
}
// ******************************************************************
// * read sections
// ******************************************************************
{
m_bzSection = new uint08*[m_Header.m_sections];
for(uint32 v=0;v<m_Header.m_sections;v++)
{
uint32 raw_size = m_SectionHeader[v].m_sizeof_raw;
uint32 raw_addr = m_SectionHeader[v].m_raw_addr;
m_bzSection[v] = new uint08[raw_size];
memset(m_bzSection[v], 0, raw_size);
if(raw_size == 0)
continue;
// ******************************************************************
// * read current section from file (if raw_size > 0)
// ******************************************************************
{
fseek(ExeFile, raw_addr, SEEK_SET);
if(fread(m_bzSection[v], raw_size, 1, ExeFile) != 1)
{
char buffer[255];
sprintf(buffer, "could not read pe section %d (%Xh)", v, v);
SetError(buffer, true);
goto cleanup;
}
}
}
}
cleanup:
fclose(ExeFile);
}
// ******************************************************************
// * ConstructorInit
// ******************************************************************
void Exe::ConstructorInit()
{
m_SectionHeader = 0;
m_bzSection = 0;
}
// ******************************************************************
// * deconstructor
// ******************************************************************
Exe::~Exe()
{
if(m_bzSection != 0)
{
for(uint32 v=0;v<m_Header.m_sections;v++)
delete[] m_bzSection[v];
delete[] m_bzSection;
}
delete[] m_SectionHeader;
}
// ******************************************************************
// * Export
// ******************************************************************
void Exe::Export(const char *x_szExeFilename)
{
if(GetError() != 0)
return;
FILE *ExeFile = fopen(x_szExeFilename, "wb");
// ******************************************************************
// * verify that file was opened
// ******************************************************************
if(ExeFile == 0)
{
SetError("could not open .exe file.", false);
return;
}
// ******************************************************************
// * write dos stub
// ******************************************************************
{
if(fwrite(bzDOSStub, sizeof(bzDOSStub), 1, ExeFile) != 1)
{
SetError("could not write dos stub", false);
goto cleanup;
}
}
// ******************************************************************
// * write pe header
// ******************************************************************
{
if(fwrite(&m_Header, sizeof(Header), 1, ExeFile) != 1)
{
SetError("could not write pe header", false);
goto cleanup;
}
}
// ******************************************************************
// * write optional header
// ******************************************************************
{
if(fwrite(&m_OptionalHeader, sizeof(OptionalHeader), 1, ExeFile) != 1)
{
SetError("could not write pe optional header", false);
goto cleanup;
}
}
// ******************************************************************
// * write section headers
// ******************************************************************
{
for(uint32 v=0;v<m_Header.m_sections;v++)
{
if(fwrite(&m_SectionHeader[v], sizeof(SectionHeader), 1, ExeFile) != 1)
{
char buffer[255];
sprintf(buffer, "could not write pe section header %d (%Xh)", v, v);
SetError(buffer, false);
goto cleanup;
}
}
}
// ******************************************************************
// * write sections
// ******************************************************************
{
for(uint32 v=0;v<m_Header.m_sections;v++)
{
uint32 RawSize = m_SectionHeader[v].m_sizeof_raw;
uint32 RawAddr = m_SectionHeader[v].m_raw_addr;
fseek(ExeFile, RawAddr, SEEK_SET);
if(RawSize == 0)
continue;
if(fwrite(m_bzSection[v], RawSize, 1, ExeFile) != 1)
{
char Buffer[255];
sprintf(Buffer, "could not write pe section %d (%Xh)", v, v);
SetError(Buffer, false);
goto cleanup;
}
}
}
cleanup:
fclose(ExeFile);
return;
}
// ******************************************************************
// * GetAddr
// ******************************************************************
uint08 *Exe::GetAddr(uint32 x_dwVirtualAddress)
{
for(uint32 v=0;v<m_Header.m_sections;v++)
{
uint32 virt_addr = m_SectionHeader[v].m_virtual_addr;
uint32 virt_size = m_SectionHeader[v].m_virtual_size;
if( (x_dwVirtualAddress >= virt_addr) && (x_dwVirtualAddress < (virt_addr + virt_size)) )
return &m_bzSection[v][x_dwVirtualAddress - virt_addr];
}
return 0;
}

1500
Source/Core/Xbe.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,318 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Standard->Cxbe->Main.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
#include <string.h>
#include <stdio.h>
// ******************************************************************
// * static functions
// ******************************************************************
void ShowUsage();
void MakeUpper(char *str);
// ******************************************************************
// * func : main
// ******************************************************************
int main(int argc, char *argv[])
{
char szErrorMessage[266] = {0};
char szExeFilename[266] = {0};
char szXbeFilename[266] = {0};
char szDumpFilename[266] = {0};
char szXbeTitle[256] = "Untitled";
bool bRetail = true;
// ******************************************************************
// * parse command line
// ******************************************************************
for(int v=1;v<argc;v++)
{
char *szOption = 0;
char *szParam = 0;
uint dwParamSize = 0;
// ******************************************************************
// * if this isn't an option, it must be the exe file
// ******************************************************************
if(argv[v][0] != '-')
{
strcpy(szExeFilename, argv[v]);
continue;
}
// ******************************************************************
// * locate colon and seperate option / parameter
// ******************************************************************
{
uint dwColon = (uint)-1;
for(uint c=1;argv[v][c] != 0;c++)
{
if(argv[v][c] == ':')
{
dwColon = c;
break;
}
}
if(dwColon == (uint)-1)
{
strcpy(szErrorMessage, "Command line format error");
goto cleanup;
}
argv[v][dwColon] = '\0';
szOption = &argv[v][1];
szParam = &argv[v][dwColon + 1];
while(szParam[dwParamSize] != 0)
dwParamSize++;
}
// ******************************************************************
// * interpret the current switch
// ******************************************************************
{
char szOptionU[266];
char szParamU[266];
strncpy(szOptionU, szOption, 265);
strncpy(szParamU, szParam, 265);
MakeUpper(szOptionU);
MakeUpper(szParamU);
if(strcmp(szOptionU, "OUT") == 0)
{
strcpy(szXbeFilename, szParam);
}
else if(strcmp(szOptionU, "DUMPINFO") == 0)
{
strcpy(szDumpFilename, szParam);
}
else if(strcmp(szOptionU, "TITLE") == 0)
{
if(dwParamSize > 256)
{
printf("WARNING: Title too long, using default title\n");
}
else
{
strcpy(szXbeTitle, szParam);
}
}
else if(strcmp(szOptionU, "MODE") == 0)
{
if(strcmp(szParamU, "RETAIL") == 0)
{
bRetail = true;
}
else if(strcmp(szParamU, "DEBUG") == 0)
{
bRetail = false;
}
else
{
strcpy(szErrorMessage, "invalid MODE");
goto cleanup;
}
}
else
{
char szBuffer[255];
sprintf(szBuffer, "Unrecognized command : %s", szOption);
strcpy(szErrorMessage, szBuffer);
goto cleanup;
}
}
}
// ******************************************************************
// * verify we recieved the required parameters
// ******************************************************************
if(szExeFilename[0] == '\0')
{
ShowUsage();
return 1;
}
// ******************************************************************
// * if we dont have an .xbe filename, generate one from exe_filename
// ******************************************************************
if(szXbeFilename[0] == '\0')
{
strcpy(szXbeFilename, szExeFilename);
char *szFilename = &szXbeFilename[0];
// ******************************************************************
// * locate last \ or / (if there are any)
// ******************************************************************
{
for(int c=0;szXbeFilename[c] != 0;c++)
{
if(szXbeFilename[c] == '\\' || szXbeFilename[c] == '/')
szFilename = &szXbeFilename[c+1];
}
}
// ******************************************************************
// * locate and remove last . (if there are any)
// ******************************************************************
{
char szWorkingU[266];
char *szWorking = szFilename;
strncpy(szWorkingU, szWorking, 265);
for(int c=0;szFilename[c] != 0;c++)
{
if(szFilename[c] == '.')
szWorking = &szFilename[c];
}
MakeUpper(szWorking);
if(strcmp(szWorkingU, ".exe") == 0)
{
strcpy(szWorking, ".xbe");
}
else
{
strcat(szXbeFilename, ".xbe");
}
}
}
// ******************************************************************
// * open, and convert exe file
// ******************************************************************
{
Exe *ExeFile = new Exe(szExeFilename);
if(ExeFile->GetError() != 0)
{
strcpy(szErrorMessage, ExeFile->GetError());
goto cleanup;
}
Xbe *XbeFile = new Xbe(ExeFile, szXbeTitle, bRetail);
if(XbeFile->GetError() != 0)
{
strcpy(szErrorMessage, XbeFile->GetError());
goto cleanup;
}
if(szDumpFilename[0] != 0)
{
XbeFile->DumpInformation(szDumpFilename);
if(XbeFile->GetError() != 0)
{
if(XbeFile->IsFatal())
{
strcpy(szErrorMessage, XbeFile->GetError());
goto cleanup;
}
else
{
printf("DUMPINFO -> Warning: %s\n", XbeFile->GetError());
XbeFile->ClearError();
}
}
}
XbeFile->Export(szXbeFilename);
if(XbeFile->GetError() != 0)
{
strcpy(szErrorMessage, XbeFile->GetError());
goto cleanup;
}
}
cleanup:
if(szErrorMessage[0] != 0)
{
ShowUsage();
printf("\n");
printf(" * Error : %s\n", szErrorMessage);
return 1;
}
return 0;
}
// ******************************************************************
// * ShowUsage
// ******************************************************************
void ShowUsage()
{
printf
(
"CXBE XBE->EXE (XBox->Win32) Relinker (CXBX Core Version " CXBX_VERSION ")\n"
"Copyright (C) Aaron Robinson 2002-2003. All rights reserved.\n"
"\n"
"Usage : cxbe [options] [exefile]\n"
"\n"
"Options :\n"
"\n"
" -OUT:filename\n"
" -DUMPINFO:filename\n"
" -TITLE:title\n"
" -MODE:{debug|retail}\n"
);
}
// ******************************************************************
// * MakeUpper
// ******************************************************************
void MakeUpper(char *str)
{
while(*str != '\0')
{
if(*str >= 'a' && *str <= 'z')
*str = *str - ('a' - 'A');
str++;
}
}

View File

@ -0,0 +1,567 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->EmuExe.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
#include "EmuExe.h"
#include "Prolog.h"
#include "Kernel.h"
#include <windows.h>
#include <memory.h>
// ******************************************************************
// * constructor
// ******************************************************************
EmuExe::EmuExe(Xbe *x_Xbe, uint32 x_debug_console) : Exe()
{
ConstructorInit();
// ******************************************************************
// * generate pe header
// ******************************************************************
{
m_Header.m_magic = *(uint32 *)"PE\0\0"; // magic number : "PE\0\0"
m_Header.m_machine = IMAGE_FILE_MACHINE_I386; // machine type : i386
m_Header.m_sections = (uint16)(x_Xbe->m_Header.dwSections + 2); // xbe sections + .cxbximp + .cxbxplg
m_Header.m_timedate = x_Xbe->m_Header.dwTimeDate; // time/date stamp
m_Header.m_symbol_table_addr = 0; // unused
m_Header.m_symbols = 0; // unused
m_Header.m_sizeof_optional_header = sizeof(OptionalHeader); // size of optional header
m_Header.m_characteristics = 0x010F; // should be fine..
}
// ******************************************************************
// * generate optional header
// ******************************************************************
{
m_OptionalHeader.m_magic = 0x010B; // magic number : 0x010B
// ******************************************************************
// * abitrary linker version : 6.0
// ******************************************************************
m_OptionalHeader.m_linker_version_major = 0x06;
m_OptionalHeader.m_linker_version_minor = 0x00;
// ******************************************************************
// * size of headers
// ******************************************************************
m_OptionalHeader.m_sizeof_headers = sizeof(bzDOSStub) + sizeof(m_Header);
m_OptionalHeader.m_sizeof_headers += sizeof(m_OptionalHeader) + sizeof(*m_SectionHeader)*m_Header.m_sections;
m_OptionalHeader.m_sizeof_headers = RoundUp(m_OptionalHeader.m_sizeof_headers, PE_FILE_ALIGN);
m_OptionalHeader.m_image_base = x_Xbe->m_Header.dwBaseAddr;
m_OptionalHeader.m_section_alignment = PE_SEGM_ALIGN;
m_OptionalHeader.m_file_alignment = PE_FILE_ALIGN;
// ******************************************************************
// * OS version : 4.0
// ******************************************************************
m_OptionalHeader.m_os_version_major = 0x0004;
m_OptionalHeader.m_os_version_minor = 0x0000;
// ******************************************************************
// * image version : 0.0
// ******************************************************************
m_OptionalHeader.m_image_version_major = 0x0000;
m_OptionalHeader.m_image_version_minor = 0x0000;
// ******************************************************************
// * subsystem version : 4.0
// ******************************************************************
m_OptionalHeader.m_subsystem_version_major = 0x0004;
m_OptionalHeader.m_subsystem_version_minor = 0x0000;
m_OptionalHeader.m_win32_version = 0x00000000;
m_OptionalHeader.m_checksum = 0x00000000;
m_OptionalHeader.m_subsystem = IMAGE_SUBSYSTEM_WINDOWS_GUI;
// ******************************************************************
// * no special dll characteristics are necessary
// ******************************************************************
m_OptionalHeader.m_dll_characteristics = 0x0000;
// ******************************************************************
// * TODO: for each of these, check for bad values and correct them
// ******************************************************************
m_OptionalHeader.m_sizeof_stack_reserve = 0x00100000;
m_OptionalHeader.m_sizeof_stack_commit = 0x00001000;
m_OptionalHeader.m_sizeof_heap_reserve = x_Xbe->m_Header.dwPeHeapReserve;
m_OptionalHeader.m_sizeof_heap_commit = x_Xbe->m_Header.dwPeHeapCommit;
// ******************************************************************
// * this member is obsolete, so we'll just set it to zero
// ******************************************************************
m_OptionalHeader.m_loader_flags = 0x00000000;
// ******************************************************************
// * we'll set this to the typical 0x10 (16)
// ******************************************************************
m_OptionalHeader.m_data_directories = 0x10;
// ******************************************************************
// * clear all data directories (we'll setup some later)
// ******************************************************************
for(uint32 d=0;d<m_OptionalHeader.m_data_directories;d++)
{
m_OptionalHeader.m_image_data_directory[d].m_virtual_addr = 0;
m_OptionalHeader.m_image_data_directory[d].m_size = 0;
}
}
// ******************************************************************
// * generate section headers
// ******************************************************************
{
m_SectionHeader = new SectionHeader[m_Header.m_sections];
// ******************************************************************
// * start appending section headers at this point
// ******************************************************************
uint32 dwSectionCursor = RoundUp(m_OptionalHeader.m_sizeof_headers, 0x1000);
// ******************************************************************
// * generate xbe section headers
// ******************************************************************
{
for(uint32 v=0;v<x_Xbe->m_Header.dwSections;v++)
{
// ******************************************************************
// * generate xbe section name
// ******************************************************************
{
memset(m_SectionHeader[v].m_name, 0, 8);
for(int c=0;c<8;c++)
{
m_SectionHeader[v].m_name[c] = x_Xbe->m_szSectionName[v][c];
if(m_SectionHeader[v].m_name[c] == '\0')
break;
}
}
// ******************************************************************
// * generate xbe section virtual size / addr
// ******************************************************************
{
uint32 VirtSize = x_Xbe->m_SectionHeader[v].dwVirtualSize;
uint32 VirtAddr = x_Xbe->m_SectionHeader[v].dwVirtualAddr - x_Xbe->m_Header.dwBaseAddr;
m_SectionHeader[v].m_virtual_size = VirtSize;
m_SectionHeader[v].m_virtual_addr = VirtAddr;
}
// ******************************************************************
// * generate xbe section raw size / addr
// ******************************************************************
{
// TODO: get this working such that m_sizeof_raw can be the actual raw size, not virtual size
uint32 RawSize = RoundUp(x_Xbe->m_SectionHeader[v].dwVirtualSize, PE_FILE_ALIGN);
uint32 RawAddr = dwSectionCursor;
m_SectionHeader[v].m_sizeof_raw = RawSize;
m_SectionHeader[v].m_raw_addr = RawAddr;
dwSectionCursor += RawSize;
}
// ******************************************************************
// * relocation / line numbers will not exist
// ******************************************************************
{
m_SectionHeader[v].m_relocations_addr = 0;
m_SectionHeader[v].m_linenumbers_addr = 0;
m_SectionHeader[v].m_relocations = 0;
m_SectionHeader[v].m_linenumbers = 0;
}
// ******************************************************************
// * generate flags for this xbe section
// ******************************************************************
{
uint32 flags = IMAGE_SCN_MEM_READ;
if(x_Xbe->m_SectionHeader[v].dwFlags.bExecutable)
{
flags |= IMAGE_SCN_MEM_EXECUTE;
flags |= IMAGE_SCN_CNT_CODE;
}
else
{
flags |= IMAGE_SCN_CNT_INITIALIZED_DATA;
}
if(x_Xbe->m_SectionHeader[v].dwFlags.bWritable)
flags |= IMAGE_SCN_MEM_WRITE;
m_SectionHeader[v].m_characteristics = flags;
}
}
}
// ******************************************************************
// * generate .cxbximp section header
// ******************************************************************
{
uint32 i = m_Header.m_sections - 2;
memcpy(m_SectionHeader[i].m_name, ".cxbximp", 8);
// ******************************************************************
// * generate .cxbximp section virtual size / addr
// ******************************************************************
{
uint32 virt_size = RoundUp(0x55, PE_SEGM_ALIGN);
uint32 virt_addr = RoundUp(m_SectionHeader[i-1].m_virtual_addr + m_SectionHeader[i-1].m_virtual_size, PE_SEGM_ALIGN);
m_SectionHeader[i].m_virtual_size = virt_size;
m_SectionHeader[i].m_virtual_addr = virt_addr;
}
// ******************************************************************
// * generate .cxbximp section raw size / addr
// ******************************************************************
{
uint32 raw_size = RoundUp(m_SectionHeader[i].m_virtual_size, PE_FILE_ALIGN);
m_SectionHeader[i].m_sizeof_raw = raw_size;
m_SectionHeader[i].m_raw_addr = dwSectionCursor;
dwSectionCursor += raw_size;
}
// ******************************************************************
// * relocation / line numbers will not exist
// ******************************************************************
{
m_SectionHeader[i].m_relocations_addr = 0;
m_SectionHeader[i].m_linenumbers_addr = 0;
m_SectionHeader[i].m_relocations = 0;
m_SectionHeader[i].m_linenumbers = 0;
}
// ******************************************************************
// * make this section readable initialized data
// ******************************************************************
m_SectionHeader[i].m_characteristics = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA;
// ******************************************************************
// * update import table directory entry
// ******************************************************************
m_OptionalHeader.m_image_data_directory[1].m_virtual_addr = m_SectionHeader[i].m_virtual_addr + 0x08;
m_OptionalHeader.m_image_data_directory[1].m_size = 0x28;
// ******************************************************************
// * update import address table directory entry
// ******************************************************************
m_OptionalHeader.m_image_data_directory[12].m_virtual_addr = m_SectionHeader[i].m_virtual_addr;
m_OptionalHeader.m_image_data_directory[12].m_size = 0x08;
}
// ******************************************************************
// * generate .cxbxplg section header
// ******************************************************************
{
uint32 i = m_Header.m_sections - 1;
memcpy(m_SectionHeader[i].m_name, ".cxbxplg", 8);
// ******************************************************************
// * generate .cxbxplg section virtual size / addr
// ******************************************************************
{
uint32 virt_size = RoundUp(0x1000 + x_Xbe->m_Header.dwSizeofHeaders, 0x1000);
uint32 virt_addr = RoundUp(m_SectionHeader[i-1].m_virtual_addr + m_SectionHeader[i-1].m_virtual_size, PE_SEGM_ALIGN);
m_SectionHeader[i].m_virtual_size = virt_size;
m_SectionHeader[i].m_virtual_addr = virt_addr;
// our entry point should be the first bytes in this section
m_OptionalHeader.m_entry = virt_addr;
}
// ******************************************************************
// * generate .cxbxplg section raw size / addr
// ******************************************************************
{
uint32 raw_size = RoundUp(m_SectionHeader[i].m_virtual_size, PE_FILE_ALIGN);
m_SectionHeader[i].m_sizeof_raw = raw_size;
m_SectionHeader[i].m_raw_addr = dwSectionCursor;
dwSectionCursor += raw_size;
}
// ******************************************************************
// * relocation / line numbers will not exist
// ******************************************************************
{
m_SectionHeader[i].m_relocations_addr = 0;
m_SectionHeader[i].m_linenumbers_addr = 0;
m_SectionHeader[i].m_relocations = 0;
m_SectionHeader[i].m_linenumbers = 0;
}
// ******************************************************************
// * make this section readable and executable
// ******************************************************************
m_SectionHeader[i].m_characteristics = IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_CNT_CODE;
}
}
// ******************************************************************
// * generate sections
// ******************************************************************
{
m_bzSection = new uint08*[m_Header.m_sections];
// ******************************************************************
// * generate xbe sections
// ******************************************************************
{
uint32 kt = x_Xbe->m_Header.dwKernelImageThunkAddr;
// ******************************************************************
// * decode kernel thunk address
// ******************************************************************
{
if(kt ^ XOR_KT_DEBUG > 0x01000000)
kt ^= XOR_KT_RETAIL;
else
kt ^= XOR_KT_DEBUG;
}
// ******************************************************************
// * generate xbe sections
// ******************************************************************
for(uint32 v=0;v<x_Xbe->m_Header.dwSections;v++)
{
uint32 SectionSize = m_SectionHeader[v].m_sizeof_raw;
m_bzSection[v] = new uint08[SectionSize];
memset(m_bzSection[v], 0, SectionSize);
memcpy(m_bzSection[v], x_Xbe->m_bzSection[v], x_Xbe->m_SectionHeader[v].dwSizeofRaw);
}
}
// ******************************************************************
// * generate .cxbximp section
// ******************************************************************
{
// ******************************************************************
// * TODO: fix up this entire chunk of code, it is a total hack
// ******************************************************************
uint32 i = m_Header.m_sections - 2;
uint32 dwVirtAddr = m_SectionHeader[i].m_virtual_addr;
uint32 dwRawSize = m_SectionHeader[i].m_sizeof_raw;
m_bzSection[i] = new uint08[dwRawSize];
memset(m_bzSection[i], 0, dwRawSize);
*(uint32*)&m_bzSection[i][0x00] = dwVirtAddr + 0x38;
*(uint32*)&m_bzSection[i][0x04] = 0;
*(uint32*)&m_bzSection[i][0x08] = dwVirtAddr + 0x30;
*(uint32*)&m_bzSection[i][0x0C] = 0;
*(uint32*)&m_bzSection[i][0x10] = 0;
*(uint32*)&m_bzSection[i][0x14] = dwVirtAddr + 0x48;
*(uint32*)&m_bzSection[i][0x18] = dwVirtAddr + 0x00;
*(uint32*)&m_bzSection[i][0x1C] = 0;
*(uint32*)&m_bzSection[i][0x20] = 0;
*(uint32*)&m_bzSection[i][0x24] = 0;
*(uint32*)&m_bzSection[i][0x28] = 0;
*(uint32*)&m_bzSection[i][0x2C] = 0;
*(uint32*)&m_bzSection[i][0x30] = dwVirtAddr + 0x38;
*(uint32*)&m_bzSection[i][0x34] = 0;
*(uint16*)&m_bzSection[i][0x38] = 0x0001;
memcpy(&m_bzSection[i][0x3A], "_EmuXDummy@0\0\0cxbx.dll\0\0\0\0\0\0", 28);
}
// ******************************************************************
// * generate .cxbxplg section
// ******************************************************************
{
uint32 ep = x_Xbe->m_Header.dwEntryAddr;
uint32 i = m_Header.m_sections - 1;
// ******************************************************************
// * decode entry point
// ******************************************************************
if( (ep ^ XOR_EP_RETAIL) > 0x01000000)
ep ^= XOR_EP_DEBUG;
else
ep ^= XOR_EP_RETAIL;
m_bzSection[i] = new uint08[m_SectionHeader[i].m_sizeof_raw];
// ******************************************************************
// * append prolog section
// ******************************************************************
memcpy(m_bzSection[i], Prolog, 0x1000);
// ******************************************************************
// * append xbe header
// ******************************************************************
memcpy(m_bzSection[i] + 0x100, &x_Xbe->m_Header, sizeof(Xbe::Header));
// ******************************************************************
// * append xbe extra header bytes
// ******************************************************************
memcpy(m_bzSection[i] + 0x100 + sizeof(Xbe::Header), x_Xbe->m_HeaderEx, x_Xbe->m_Header.dwSizeofHeaders - sizeof(Xbe::Header));
// ******************************************************************
// * patch prolog function parameters
// ******************************************************************
*(uint32 *)((uint32)m_bzSection[i] + 1) = (uint32)EmuXInit;
*(uint32 *)((uint32)m_bzSection[i] + 6) = (uint32)ep;
*(uint32 *)((uint32)m_bzSection[i] + 11) = (uint32)x_Xbe->m_Header.dwSizeofHeaders;
*(uint32 *)((uint32)m_bzSection[i] + 16) = m_SectionHeader[i].m_virtual_addr + m_OptionalHeader.m_image_base + 0x100;
*(uint32 *)((uint32)m_bzSection[i] + 21) = x_debug_console;
}
}
// ******************************************************************
// * patch kernel thunk table
// ******************************************************************
{
uint32 kt = x_Xbe->m_Header.dwKernelImageThunkAddr;
// ******************************************************************
// * decode kernel thunk address
// ******************************************************************
{
if( (kt ^ XOR_KT_DEBUG) > 0x01000000)
kt ^= XOR_KT_RETAIL;
else
kt ^= XOR_KT_DEBUG;
}
// ******************************************************************
// * locate section containing kernel thunk table
// ******************************************************************
for(uint32 v=0;v<x_Xbe->m_Header.dwSections;v++)
{
uint32 imag_base = m_OptionalHeader.m_image_base;
uint32 virt_addr = m_SectionHeader[v].m_virtual_addr;
uint32 virt_size = m_SectionHeader[v].m_virtual_size;
// ******************************************************************
// * modify kernel thunk table, if found
// ******************************************************************
if(kt >= virt_addr + imag_base && kt < virt_addr + virt_size + imag_base)
{
uint32 *kt_tbl = (uint32*)&m_bzSection[v][kt - virt_addr - imag_base];
while(*kt_tbl != 0)
*kt_tbl++ = KernelThunkTable[*kt_tbl & 0x7FFFFFFF];
break;
}
}
}
// ******************************************************************
// * update imcomplete header fields
// ******************************************************************
{
// ******************************************************************
// * calculate size of code / data / image
// ******************************************************************
{
uint32 sizeof_code = 0;
uint32 sizeof_data = 0;
uint32 sizeof_undata = 0;
uint32 sizeof_image = 0;
for(uint32 v=0;v<m_Header.m_sections;v++)
{
uint32 characteristics = m_SectionHeader[v].m_characteristics;
if( (characteristics & IMAGE_SCN_MEM_EXECUTE) || (characteristics & IMAGE_SCN_CNT_CODE) )
sizeof_code += m_SectionHeader[v].m_sizeof_raw;
if( (characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) )
sizeof_data += m_SectionHeader[v].m_sizeof_raw;
}
// ******************************************************************
// * calculate size of image
// ******************************************************************
sizeof_image = sizeof_undata + sizeof_data + sizeof_code + m_OptionalHeader.m_sizeof_headers;
sizeof_image = RoundUp(sizeof_image, PE_SEGM_ALIGN);
// ******************************************************************
// * update optional header as necessary
// ******************************************************************
m_OptionalHeader.m_sizeof_code = sizeof_code;
m_OptionalHeader.m_sizeof_initialized_data = sizeof_data;
m_OptionalHeader.m_sizeof_uninitialized_data = sizeof_undata;
m_OptionalHeader.m_sizeof_image = sizeof_image;
}
// ******************************************************************
// * we'll set code base as the virtual address of the first section
// ******************************************************************
m_OptionalHeader.m_code_base = m_SectionHeader[0].m_virtual_addr;
// ******************************************************************
// * we'll set data base as the virtual address of the first section
// * that is not marked as containing code or being executable
// ******************************************************************
for(uint32 v=0;v<m_Header.m_sections;v++)
{
uint32 characteristics = m_SectionHeader[v].m_characteristics;
if( !(characteristics & IMAGE_SCN_MEM_EXECUTE) || !(characteristics & IMAGE_SCN_CNT_CODE) )
{
m_OptionalHeader.m_data_base = m_SectionHeader[v].m_virtual_addr;
break;
}
}
}
}

View File

@ -0,0 +1,66 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->Prolog.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
// ******************************************************************
// * .cxbxplg
// ******************************************************************
#pragma code_seg(".cxbxplg")
#pragma comment(linker, "/SECTION:.cxbxplg,RW")
// ******************************************************************
// * Func : Prolog
// ******************************************************************
__declspec(allocate(".cxbxplg")) uint08 Prolog[] =
{
// ******************************************************************
// *
// * WARNING:
// *
// * This function is hard-coded as an array to stress the point that
// * it can not be modified (unless you really know what you're
// * doing). EmuExe will modify the contents of this function
// * directly, so this precise structure is necessary.
// *
// ******************************************************************
0xBE, 0xC3, 0xC3, 0xC3, 0xC3, // mov esi, 0xC3C3C3C3
0x68, 0xC3, 0xC3, 0xC3, 0xC3, // push 0xC3C3C3C3
0x68, 0xC3, 0xC3, 0xC3, 0xC3, // push 0xC3C3C3C3
0x68, 0xC3, 0xC3, 0xC3, 0xC3, // push 0xC3C3C3C3
0x68, 0xC3, 0xC3, 0xC3, 0xC3, // push 0xC3C3C3C3
0xFF, 0xD6, // call esi
0xC3 // ret
};
#pragma code_seg()

View File

@ -0,0 +1,56 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->WinMain.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
#include "EmuExe.h"
#include "WndMain.h"
#include <windows.h>
// ******************************************************************
// * func : WinMain
// ******************************************************************
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WndMain *caustik = new WndMain(hInstance);
while(caustik->GetError() == 0 && caustik->ProcessMessages())
Sleep(10);
if(caustik->GetError() != 0)
MessageBox(NULL, caustik->GetError(), "cxbx", MB_OK);
delete caustik;
return 0;
}

177
Source/Win32/Cxbx/Wnd.cpp Normal file
View File

@ -0,0 +1,177 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->Wnd.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
#include "Wnd.h"
#include "resource.h"
// ******************************************************************
// * constructor
// ******************************************************************
Wnd::Wnd(HINSTANCE x_hInstance) : m_hInstance(x_hInstance)
{
m_classname = "CxbxWnd";
m_wndname = "Cxbx Generic Window";
m_x = 150;
m_y = 150;
m_w = 320;
m_h = 240;
m_parent = NULL;
m_clsstyle = CS_HREDRAW | CS_VREDRAW;
m_wndstyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE;
m_background = (HBRUSH)GetStockObject(BLACK_BRUSH);
m_initialized = false;
return;
}
// ******************************************************************
// * deconstructor
// ******************************************************************
Wnd::~Wnd()
{
}
// ******************************************************************
// * ProcessMessages
// ******************************************************************
bool Wnd::ProcessMessages()
{
// initialize window
if(!m_initialized)
{
m_initialized = true;
WNDCLASS wnd_class;
wnd_class.hInstance = m_hInstance;
wnd_class.lpszClassName = m_classname;
wnd_class.lpfnWndProc = WndProcForward;
wnd_class.style = m_clsstyle;
wnd_class.hIcon = LoadIcon(m_hInstance, MAKEINTRESOURCE(IDI_CXBX));
wnd_class.hCursor = LoadCursor(NULL, IDC_ARROW);
wnd_class.lpszMenuName = NULL;
wnd_class.cbClsExtra = 0;
wnd_class.cbWndExtra = 0;
wnd_class.hbrBackground = m_background;
m_class = RegisterClass(&wnd_class);
m_hwnd = CreateWindowEx
(
NULL,
m_classname,
m_wndname,
m_wndstyle,
m_x,
m_y,
m_w,
m_h,
m_parent,
NULL,
m_hInstance,
this
);
if(m_hwnd == 0)
{
SetError("Could not create window.", true);
UnregisterClass(m_classname, m_hInstance);
goto cleanup;
}
SetWindowLong(m_hwnd, GWL_USERDATA, (LONG)this);
cleanup:;
}
MSG msg;
if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if(!GetMessage(&msg, NULL, 0, 0))
{
UnregisterClass(m_classname, m_hInstance);
return false;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return true;
}
// ******************************************************************
// * WndProcForward
// ******************************************************************
LRESULT CALLBACK Wnd::WndProcForward(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
Wnd *forward_to = (Wnd*)GetWindowLong(hwnd, GWL_USERDATA);
if(forward_to == 0)
{
if(uMsg == WM_CREATE)
{
LPCREATESTRUCT cs = (LPCREATESTRUCT)lParam;
forward_to = (Wnd*)cs->lpCreateParams;
}else{
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
}
return forward_to->WndProc(hwnd, uMsg, wParam, lParam);
}
// ******************************************************************
// * WndProc
// ******************************************************************
LRESULT CALLBACK Wnd::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
return 0;
}

View File

@ -0,0 +1,184 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->Cxbx->WndAbout.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
#include "WndAbout.h"
#include "resource.h"
// ******************************************************************
// * constructor
// ******************************************************************
WndAbout::WndAbout(HINSTANCE x_hInstance, HWND x_parent) : Wnd(x_hInstance)
{
m_classname = "WndAbout";
m_wndname = "Cxbx - About";
m_w = 200;
m_h = 120;
// center to parent
{
RECT rect;
GetWindowRect(x_parent, &rect);
m_x = rect.left + (rect.right - rect.left)/2 - m_w/2;
m_y = rect.top + (rect.bottom - rect.top)/2 - m_h/2;
}
m_parent = x_parent;
m_wndstyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_VISIBLE;
return;
}
// ******************************************************************
// * deconstructor
// ******************************************************************
WndAbout::~WndAbout()
{
}
// ******************************************************************
// * WndProc
// ******************************************************************
LRESULT CALLBACK WndAbout::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_CREATE:
{
EnableWindow(m_parent, FALSE);
HDC hDC = GetDC(hwnd);
int nHeight = -MulDiv(8, GetDeviceCaps(hDC, LOGPIXELSY), 72);
m_hFont = CreateFont(nHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, FF_ROMAN, "verdana");
ReleaseDC(hwnd, hDC);
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(hwnd, &ps);
HDC hDC = GetDC(hwnd);
// draw text
{
HGDIOBJ tmpObj = SelectObject(hDC, m_hFont);
// draw top version bar and bottom url bar
{
SetBkColor(hDC, GetSysColor(COLOR_HIGHLIGHT));
SetTextColor(hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
// top version bar
{
char buffer[] = " Cxbx Version " CXBX_VERSION;
RECT rect = {0, 0, 200, 14};
ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rect, buffer, strlen(buffer), 0);
}
// bottom url bar
{
char buffer[] = " http://www.caustik.com/xbox/";
RECT rect = {0, 74, 200, 88};
ExtTextOut(hDC, 0, 74, ETO_OPAQUE, &rect, buffer, strlen(buffer), 0);
}
}
// draw credits
{
SetBkColor(hDC, RGB(0,0,0));
SetTextColor(hDC, RGB(0xFF,0xFF,0xFF));
char bufferA[] = " The First XBox Emulator";
char bufferB[] = " Designed and Coded by Caustik";
char bufferC[] = " (Click Window to Close)";
RECT rectA = {0, 22, 200, 37};
ExtTextOut(hDC, 0, 22, ETO_OPAQUE, &rectA, bufferA, strlen(bufferA), 0);
RECT rectB = {0, 37, 200, 51};
ExtTextOut(hDC, 0, 37, ETO_OPAQUE, &rectB, bufferB, strlen(bufferB), 0);
RECT rectC = {22, 53, 70, 67};
ExtTextOut(hDC, 22, 53, ETO_OPAQUE, &rectC, bufferC, strlen(bufferC), 0);
}
SelectObject(hDC, tmpObj);
}
if(hDC != NULL)
ReleaseDC(hwnd, hDC);
EndPaint(hwnd, &ps);
}
break;
case WM_LBUTTONUP:
{
SendMessage(hwnd, WM_CLOSE, 0, 0);
}
break;
case WM_CLOSE:
{
EnableWindow(m_parent, TRUE);
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
{
DeleteObject(m_hFont);
PostQuitMessage(0);
}
break;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,151 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->CxbxKrnl->Kernel.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
#define CXBXKRNL_INTERNAL
#define _XBOXKRNL_LOCAL_
#include "Kernel.h"
#include <stdio.h>
// ******************************************************************
// * ntdll wrapped in namespace to avoid collisions
// ******************************************************************
namespace xntdll
{
#include "xntdll.h"
};
// ******************************************************************
// * win32 wrapped in namespace to avoid collisions
// ******************************************************************
namespace win32
{
#include <windows.h>
};
using namespace win32;
// ******************************************************************
// * func: EmuXInit
// ******************************************************************
CXBXKRNL_API void NTAPI EmuXInit(uint32 DebugConsole, uint08 *XBEHeader, uint32 XBEHeaderSize, void (*Entry)())
{
if(DebugConsole)
{
AllocConsole();
freopen("CONOUT$", "w", stdout);
printf("%s", "CxbxKrnl: Debug console allocated.\n");
}
printf("CxbxKrnl: EmuXInit(0x%.08X, %d, 0x%.08X)\n", XBEHeader, XBEHeaderSize, Entry);
Entry();
return;
}
// ******************************************************************
// * func: EmuXDummy
// ******************************************************************
CXBXKRNL_API void NTAPI EmuXDummy()
{
}
// ******************************************************************
// * func: EmuXPanic
// ******************************************************************
CXBXKRNL_API void NTAPI EmuXPanic()
{
printf("CxbxKrnl: EmuXPanic()\n");
MessageBox(NULL, "Kernel Panic! Process will now terminate.", "CxbxKrnl", MB_OK | MB_ICONEXCLAMATION);
exit(1);
}
using namespace xboxkrnl;
// ******************************************************************
// * 0x00BB - NtClose
// ******************************************************************
XBSYSAPI EXPORTNUM(187) NTSTATUS NTAPI xboxkrnl::NtClose
(
IN HANDLE Handle
)
{
return STATUS_SUCCESS;
}
// ******************************************************************
// * 0x00FF - PsCreateSystemThreadEx
// ******************************************************************
XBSYSAPI EXPORTNUM(255) NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadEx
(
OUT PHANDLE ThreadHandle,
IN ULONG ThreadExtraSize,
IN ULONG KernelStackSize,
IN ULONG TlsDataSize,
OUT PULONG ThreadId OPTIONAL,
IN PVOID StartContext1,
IN PVOID StartContext2,
IN BOOLEAN CreateSuspended,
IN BOOLEAN DebugStack,
IN PKSTART_ROUTINE StartRoutine
)
{
return STATUS_SUCCESS;
}
// ******************************************************************
// * 0x0031 - HalReturnToFirmware
// ******************************************************************
XBSYSAPI EXPORTNUM(49) VOID DECLSPEC_NORETURN xboxkrnl::HalReturnToFirmware
(
RETURN_FIRMWARE Routine
)
{
/*
ReturnFirmwareHalt = 0x0,
ReturnFirmwareReboot = 0x1,
ReturnFirmwareQuickReboot = 0x2,
ReturnFirmwareHard = 0x3,
ReturnFirmwareFatal = 0x4,
ReturnFirmwareAll = 0x5
*/
exit(1);
}

View File

@ -0,0 +1,420 @@
// ******************************************************************
// *
// * .,-::::: .,:: .::::::::. .,:: .:
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
// * $$$ Y$$$P $$""""Y$$ Y$$$P
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
// *
// * Cxbx->Win32->CxbxKrnl->KernelThunkTable.cpp
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
// *
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
#define CXBXKRNL_INTERNAL
#define _XBOXKRNL_LOCAL_
#include "Kernel.h"
// ******************************************************************
// * NOTE:
// ******************************************************************
// * i typically enable "#define PANIC(numb) numb" whenever i want
// * to find out what kernel export is trying to be called but is
// * not implemented yet (no prototype exists). otherwise, enable
// * "#define PANIC(numb) cxbx_panic"
// ******************************************************************
#define PANIC(numb) EmuXPanic
//#define PANIC(numb) numb
CXBXKRNL_API uint32 KernelThunkTable[367] =
{
(uint32)PANIC(0x0000), // 0x0000 (0)
(uint32)PANIC(0x0001), // 0x0001 (1)
(uint32)PANIC(0x0002), // 0x0002 (2)
(uint32)PANIC(0x0003), // 0x0003 (3)
(uint32)PANIC(0x0004), // 0x0004 (4)
(uint32)PANIC(0x0005), // 0x0005 (5)
(uint32)PANIC(0x0006), // 0x0006 (6)
(uint32)PANIC(0x0007), // 0x0007 (7)
(uint32)PANIC(0x0008), // 0x0008 (8)
(uint32)PANIC(0x0009), // 0x0009 (9)
(uint32)PANIC(0x000A), // 0x000A (10)
(uint32)PANIC(0x000B), // 0x000B (11)
(uint32)PANIC(0x000C), // 0x000C (12)
(uint32)PANIC(0x000D), // 0x000D (13)
(uint32)PANIC(0x000E), // 0x000E (14)
(uint32)PANIC(0x000F), // 0x000F (15)
(uint32)PANIC(0x0010), // 0x0010 (16)
(uint32)PANIC(0x0011), // 0x0011 (17)
(uint32)PANIC(0x0012), // 0x0012 (18)
(uint32)PANIC(0x0013), // 0x0013 (19)
(uint32)PANIC(0x0014), // 0x0014 (20)
(uint32)PANIC(0x0015), // 0x0015 (21)
(uint32)PANIC(0x0016), // 0x0016 (22)
(uint32)PANIC(0x0017), // 0x0017 (23)
(uint32)PANIC(0x0018), // 0x0018 (24)
(uint32)PANIC(0x0019), // 0x0019 (25)
(uint32)PANIC(0x001A), // 0x001A (26)
(uint32)PANIC(0x001B), // 0x001B (27)
(uint32)PANIC(0x001C), // 0x001C (28)
(uint32)PANIC(0x001D), // 0x001D (29)
(uint32)PANIC(0x001E), // 0x001E (30)
(uint32)PANIC(0x001F), // 0x001F (31)
(uint32)PANIC(0x0020), // 0x0020 (32)
(uint32)PANIC(0x0021), // 0x0021 (33)
(uint32)PANIC(0x0022), // 0x0022 (34)
(uint32)PANIC(0x0023), // 0x0023 (35)
(uint32)PANIC(0x0024), // 0x0024 (36)
(uint32)PANIC(0x0025), // 0x0025 (37)
(uint32)PANIC(0x0026), // 0x0026 (38)
(uint32)PANIC(0x0027), // 0x0027 (39)
(uint32)PANIC(0x0028), // 0x0028 (40)
(uint32)PANIC(0x0029), // 0x0029 (41)
(uint32)PANIC(0x002A), // 0x002A (42)
(uint32)PANIC(0x002B), // 0x002B (43)
(uint32)PANIC(0x002C), // 0x002C (44)
(uint32)PANIC(0x002D), // 0x002D (45)
(uint32)PANIC(0x002E), // 0x002E (46)
(uint32)PANIC(0x002F), // 0x002F (47)
(uint32)PANIC(0x0030), // 0x0030 (48)
(uint32)&xboxkrnl::HalReturnToFirmware, // 0x0031 (49)
(uint32)PANIC(0x0032), // 0x0032 (50)
(uint32)PANIC(0x0033), // 0x0033 (51)
(uint32)PANIC(0x0034), // 0x0034 (52)
(uint32)PANIC(0x0035), // 0x0035 (53)
(uint32)PANIC(0x0036), // 0x0036 (54)
(uint32)PANIC(0x0037), // 0x0037 (55)
(uint32)PANIC(0x0038), // 0x0038 (56)
(uint32)PANIC(0x0039), // 0x0039 (57)
(uint32)PANIC(0x003A), // 0x003A (58)
(uint32)PANIC(0x003B), // 0x003B (59)
(uint32)PANIC(0x003C), // 0x003C (60)
(uint32)PANIC(0x003D), // 0x003D (61)
(uint32)PANIC(0x003E), // 0x003E (62)
(uint32)PANIC(0x003F), // 0x003F (63)
(uint32)PANIC(0x0040), // 0x0040 (64)
(uint32)PANIC(0x0041), // 0x0041 (65)
(uint32)PANIC(0x0042), // 0x0042 (66)
(uint32)PANIC(0x0043), // 0x0043 (67)
(uint32)PANIC(0x0044), // 0x0044 (68)
(uint32)PANIC(0x0045), // 0x0045 (69)
(uint32)PANIC(0x0046), // 0x0046 (70)
(uint32)PANIC(0x0047), // 0x0047 (71)
(uint32)PANIC(0x0048), // 0x0048 (72)
(uint32)PANIC(0x0049), // 0x0049 (73)
(uint32)PANIC(0x004A), // 0x004A (74)
(uint32)PANIC(0x004B), // 0x004B (75)
(uint32)PANIC(0x004C), // 0x004C (76)
(uint32)PANIC(0x004D), // 0x004D (77)
(uint32)PANIC(0x004E), // 0x004E (78)
(uint32)PANIC(0x004F), // 0x004F (79)
(uint32)PANIC(0x0050), // 0x0050 (80)
(uint32)PANIC(0x0051), // 0x0051 (81)
(uint32)PANIC(0x0052), // 0x0052 (82)
(uint32)PANIC(0x0053), // 0x0053 (83)
(uint32)PANIC(0x0054), // 0x0054 (84)
(uint32)PANIC(0x0055), // 0x0055 (85)
(uint32)PANIC(0x0056), // 0x0056 (86)
(uint32)PANIC(0x0057), // 0x0057 (87)
(uint32)PANIC(0x0058), // 0x0058 (88)
(uint32)PANIC(0x0059), // 0x0059 (89)
(uint32)PANIC(0x005A), // 0x005A (90)
(uint32)PANIC(0x005B), // 0x005B (91)
(uint32)PANIC(0x005C), // 0x005C (92)
(uint32)PANIC(0x005D), // 0x005D (93)
(uint32)PANIC(0x005E), // 0x005E (94)
(uint32)PANIC(0x005F), // 0x005F (95)
(uint32)PANIC(0x0060), // 0x0060 (96)
(uint32)PANIC(0x0061), // 0x0061 (97)
(uint32)PANIC(0x0062), // 0x0062 (98)
(uint32)PANIC(0x0063), // 0x0063 (99)
(uint32)PANIC(0x0064), // 0x0064 (100)
(uint32)PANIC(0x0065), // 0x0065 (101)
(uint32)PANIC(0x0066), // 0x0066 (102)
(uint32)PANIC(0x0067), // 0x0067 (103)
(uint32)PANIC(0x0068), // 0x0068 (104)
(uint32)PANIC(0x0069), // 0x0069 (105)
(uint32)PANIC(0x006A), // 0x006A (106)
(uint32)PANIC(0x006B), // 0x006B (107)
(uint32)PANIC(0x006C), // 0x006C (108)
(uint32)PANIC(0x006D), // 0x006D (109)
(uint32)PANIC(0x006E), // 0x006E (110)
(uint32)PANIC(0x006F), // 0x006F (111)
(uint32)PANIC(0x0070), // 0x0070 (112)
(uint32)PANIC(0x0071), // 0x0071 (113)
(uint32)PANIC(0x0072), // 0x0072 (114)
(uint32)PANIC(0x0073), // 0x0073 (115)
(uint32)PANIC(0x0074), // 0x0074 (116)
(uint32)PANIC(0x0075), // 0x0075 (117)
(uint32)PANIC(0x0076), // 0x0076 (118)
(uint32)PANIC(0x0077), // 0x0077 (119)
(uint32)PANIC(0x0078), // 0x0078 (120)
(uint32)PANIC(0x0079), // 0x0079 (121)
(uint32)PANIC(0x007A), // 0x007A (122)
(uint32)PANIC(0x007B), // 0x007B (123)
(uint32)PANIC(0x007C), // 0x007C (124)
(uint32)PANIC(0x007D), // 0x007D (125)
(uint32)PANIC(0x007E), // 0x007E (126)
(uint32)PANIC(0x007F), // 0x007F (127)
(uint32)PANIC(0x0080), // 0x0080 (128)
(uint32)PANIC(0x0081), // 0x0081 (129)
(uint32)PANIC(0x0082), // 0x0082 (130)
(uint32)PANIC(0x0083), // 0x0083 (131)
(uint32)PANIC(0x0084), // 0x0084 (132)
(uint32)PANIC(0x0085), // 0x0085 (133)
(uint32)PANIC(0x0086), // 0x0086 (134)
(uint32)PANIC(0x0087), // 0x0087 (135)
(uint32)PANIC(0x0088), // 0x0088 (136)
(uint32)PANIC(0x0089), // 0x0089 (137)
(uint32)PANIC(0x008A), // 0x008A (138)
(uint32)PANIC(0x008B), // 0x008B (139)
(uint32)PANIC(0x008C), // 0x008C (140)
(uint32)PANIC(0x008D), // 0x008D (141)
(uint32)PANIC(0x008E), // 0x008E (142)
(uint32)PANIC(0x008F), // 0x008F (143)
(uint32)PANIC(0x0090), // 0x0090 (144)
(uint32)PANIC(0x0091), // 0x0091 (145)
(uint32)PANIC(0x0092), // 0x0092 (146)
(uint32)PANIC(0x0093), // 0x0093 (147)
(uint32)PANIC(0x0094), // 0x0094 (148)
(uint32)PANIC(0x0095), // 0x0095 (149)
(uint32)PANIC(0x0096), // 0x0096 (150)
(uint32)PANIC(0x0097), // 0x0097 (151)
(uint32)PANIC(0x0098), // 0x0098 (152)
(uint32)PANIC(0x0099), // 0x0099 (153)
(uint32)PANIC(0x009A), // 0x009A (154)
(uint32)PANIC(0x009B), // 0x009B (155)
(uint32)PANIC(0x009C), // 0x009C (156)
(uint32)PANIC(0x009D), // 0x009D (157)
(uint32)PANIC(0x009E), // 0x009E (158)
(uint32)PANIC(0x009F), // 0x009F (159)
(uint32)PANIC(0x00A0), // 0x00A0 (160)
(uint32)PANIC(0x00A1), // 0x00A1 (161)
(uint32)PANIC(0x00A2), // 0x00A2 (162)
(uint32)PANIC(0x00A3), // 0x00A3 (163)
(uint32)PANIC(0x00A4), // 0x00A4 (164)
(uint32)PANIC(0x00A5), // 0x00A5 (165)
(uint32)PANIC(0x00A6), // 0x00A6 (166)
(uint32)PANIC(0x00A7), // 0x00A7 (167)
(uint32)PANIC(0x00A8), // 0x00A8 (168)
(uint32)PANIC(0x00A9), // 0x00A9 (169)
(uint32)PANIC(0x00AA), // 0x00AA (170)
(uint32)PANIC(0x00AB), // 0x00AB (171)
(uint32)PANIC(0x00AC), // 0x00AC (172)
(uint32)PANIC(0x00AD), // 0x00AD (173)
(uint32)PANIC(0x00AE), // 0x00AE (174)
(uint32)PANIC(0x00AF), // 0x00AF (175)
(uint32)PANIC(0x00B0), // 0x00B0 (176)
(uint32)PANIC(0x00B1), // 0x00B1 (177)
(uint32)PANIC(0x00B2), // 0x00B2 (178)
(uint32)PANIC(0x00B3), // 0x00B3 (179)
(uint32)PANIC(0x00B4), // 0x00B4 (180)
(uint32)PANIC(0x00B5), // 0x00B5 (181)
(uint32)PANIC(0x00B6), // 0x00B6 (182)
(uint32)PANIC(0x00B7), // 0x00B7 (183)
(uint32)PANIC(0x00B8), // 0x00B8 (184)
(uint32)PANIC(0x00B9), // 0x00B9 (185)
(uint32)PANIC(0x00BA), // 0x00BA (186)
(uint32)&xboxkrnl::NtClose, // 0x00BB (187)
(uint32)PANIC(0x00BC), // 0x00BC (188)
(uint32)PANIC(0x00BD), // 0x00BD (189)
(uint32)PANIC(0x00BE), // 0x00BE (190)
(uint32)PANIC(0x00BF), // 0x00BF (191)
(uint32)PANIC(0x00C0), // 0x00C0 (192)
(uint32)PANIC(0x00C1), // 0x00C1 (193)
(uint32)PANIC(0x00C2), // 0x00C2 (194)
(uint32)PANIC(0x00C3), // 0x00C3 (195)
(uint32)PANIC(0x00C4), // 0x00C4 (196)
(uint32)PANIC(0x00C5), // 0x00C5 (197)
(uint32)PANIC(0x00C6), // 0x00C6 (198)
(uint32)PANIC(0x00C7), // 0x00C7 (199)
(uint32)PANIC(0x00C8), // 0x00C8 (200)
(uint32)PANIC(0x00C9), // 0x00C9 (201)
(uint32)PANIC(0x00CA), // 0x00CA (202)
(uint32)PANIC(0x00CB), // 0x00CB (203)
(uint32)PANIC(0x00CC), // 0x00CC (204)
(uint32)PANIC(0x00CD), // 0x00CD (205)
(uint32)PANIC(0x00CE), // 0x00CE (206)
(uint32)PANIC(0x00CF), // 0x00CF (207)
(uint32)PANIC(0x00D0), // 0x00D0 (208)
(uint32)PANIC(0x00D1), // 0x00D1 (209)
(uint32)PANIC(0x00D2), // 0x00D2 (210)
(uint32)PANIC(0x00D3), // 0x00D3 (211)
(uint32)PANIC(0x00D4), // 0x00D4 (212)
(uint32)PANIC(0x00D5), // 0x00D5 (213)
(uint32)PANIC(0x00D6), // 0x00D6 (214)
(uint32)PANIC(0x00D7), // 0x00D7 (215)
(uint32)PANIC(0x00D8), // 0x00D8 (216)
(uint32)PANIC(0x00D9), // 0x00D9 (217)
(uint32)PANIC(0x00DA), // 0x00DA (218)
(uint32)PANIC(0x00DB), // 0x00DB (219)
(uint32)PANIC(0x00DC), // 0x00DC (220)
(uint32)PANIC(0x00DD), // 0x00DD (221)
(uint32)PANIC(0x00DE), // 0x00DE (222)
(uint32)PANIC(0x00DF), // 0x00DF (223)
(uint32)PANIC(0x00E0), // 0x00E0 (224)
(uint32)PANIC(0x00E1), // 0x00E1 (225)
(uint32)PANIC(0x00E2), // 0x00E2 (226)
(uint32)PANIC(0x00E3), // 0x00E3 (227)
(uint32)PANIC(0x00E4), // 0x00E4 (228)
(uint32)PANIC(0x00E5), // 0x00E5 (229)
(uint32)PANIC(0x00E6), // 0x00E6 (230)
(uint32)PANIC(0x00E7), // 0x00E7 (231)
(uint32)PANIC(0x00E8), // 0x00E8 (232)
(uint32)PANIC(0x00E9), // 0x00E9 (233)
(uint32)PANIC(0x00EA), // 0x00EA (234)
(uint32)PANIC(0x00EB), // 0x00EB (235)
(uint32)PANIC(0x00EC), // 0x00EC (236)
(uint32)PANIC(0x00ED), // 0x00ED (237)
(uint32)PANIC(0x00EE), // 0x00EE (238)
(uint32)PANIC(0x00EF), // 0x00EF (239)
(uint32)PANIC(0x00F0), // 0x00F0 (240)
(uint32)PANIC(0x00F1), // 0x00F1 (241)
(uint32)PANIC(0x00F2), // 0x00F2 (242)
(uint32)PANIC(0x00F3), // 0x00F3 (243)
(uint32)PANIC(0x00F4), // 0x00F4 (244)
(uint32)PANIC(0x00F5), // 0x00F5 (245)
(uint32)PANIC(0x00F6), // 0x00F6 (246)
(uint32)PANIC(0x00F7), // 0x00F7 (247)
(uint32)PANIC(0x00F8), // 0x00F8 (248)
(uint32)PANIC(0x00F9), // 0x00F9 (249)
(uint32)PANIC(0x00FA), // 0x00FA (250)
(uint32)PANIC(0x00FB), // 0x00FB (251)
(uint32)PANIC(0x00FC), // 0x00FC (252)
(uint32)PANIC(0x00FD), // 0x00FD (253)
(uint32)PANIC(0x00FE), // 0x00FE (254)
(uint32)&xboxkrnl::PsCreateSystemThreadEx, // 0x00FF (255)
(uint32)PANIC(0x0100), // 0x0100 (256)
(uint32)PANIC(0x0101), // 0x0101 (257)
(uint32)PANIC(0x0102), // 0x0102 (258)
(uint32)PANIC(0x0103), // 0x0103 (259)
(uint32)PANIC(0x0104), // 0x0104 (260)
(uint32)PANIC(0x0105), // 0x0105 (261)
(uint32)PANIC(0x0106), // 0x0106 (262)
(uint32)PANIC(0x0107), // 0x0107 (263)
(uint32)PANIC(0x0108), // 0x0108 (264)
(uint32)PANIC(0x0109), // 0x0109 (265)
(uint32)PANIC(0x010A), // 0x010A (266)
(uint32)PANIC(0x010B), // 0x010B (267)
(uint32)PANIC(0x010C), // 0x010C (268)
(uint32)PANIC(0x010D), // 0x010D (269)
(uint32)PANIC(0x010E), // 0x010E (270)
(uint32)PANIC(0x010F), // 0x010F (271)
(uint32)PANIC(0x0110), // 0x0110 (272)
(uint32)PANIC(0x0111), // 0x0111 (273)
(uint32)PANIC(0x0112), // 0x0112 (274)
(uint32)PANIC(0x0113), // 0x0113 (275)
(uint32)PANIC(0x0114), // 0x0114 (276)
(uint32)PANIC(0x0115), // 0x0115 (277)
(uint32)PANIC(0x0116), // 0x0116 (278)
(uint32)PANIC(0x0117), // 0x0117 (279)
(uint32)PANIC(0x0118), // 0x0118 (280)
(uint32)PANIC(0x0119), // 0x0119 (281)
(uint32)PANIC(0x011A), // 0x011A (282)
(uint32)PANIC(0x011B), // 0x011B (283)
(uint32)PANIC(0x011C), // 0x011C (284)
(uint32)PANIC(0x011D), // 0x011D (285)
(uint32)PANIC(0x011E), // 0x011E (286)
(uint32)PANIC(0x011F), // 0x011F (287)
(uint32)PANIC(0x0120), // 0x0120 (288)
(uint32)PANIC(0x0121), // 0x0121 (289)
(uint32)PANIC(0x0122), // 0x0122 (290)
(uint32)PANIC(0x0123), // 0x0123 (291)
(uint32)PANIC(0x0124), // 0x0124 (292)
(uint32)PANIC(0x0125), // 0x0125 (293)
(uint32)PANIC(0x0126), // 0x0126 (294)
(uint32)PANIC(0x0127), // 0x0127 (295)
(uint32)PANIC(0x0128), // 0x0128 (296)
(uint32)PANIC(0x0129), // 0x0129 (297)
(uint32)PANIC(0x012A), // 0x012A (298)
(uint32)PANIC(0x012B), // 0x012B (299)
(uint32)PANIC(0x012C), // 0x012C (300)
(uint32)PANIC(0x012D), // 0x012D (301)
(uint32)PANIC(0x012E), // 0x012E (302)
(uint32)PANIC(0x012F), // 0x012F (303)
(uint32)PANIC(0x0130), // 0x0130 (304)
(uint32)PANIC(0x0131), // 0x0131 (305)
(uint32)PANIC(0x0132), // 0x0132 (306)
(uint32)PANIC(0x0133), // 0x0133 (307)
(uint32)PANIC(0x0134), // 0x0134 (308)
(uint32)PANIC(0x0135), // 0x0135 (309)
(uint32)PANIC(0x0136), // 0x0136 (310)
(uint32)PANIC(0x0137), // 0x0137 (311)
(uint32)PANIC(0x0138), // 0x0138 (312)
(uint32)PANIC(0x0139), // 0x0139 (313)
(uint32)PANIC(0x013A), // 0x013A (314)
(uint32)PANIC(0x013B), // 0x013B (315)
(uint32)PANIC(0x013C), // 0x013C (316)
(uint32)PANIC(0x013D), // 0x013D (317)
(uint32)PANIC(0x013E), // 0x013E (318)
(uint32)PANIC(0x013F), // 0x013F (319)
(uint32)PANIC(0x0140), // 0x0140 (320)
(uint32)PANIC(0x0141), // 0x0141 (321)
(uint32)PANIC(0x0142), // 0x0142 (322)
(uint32)PANIC(0x0143), // 0x0143 (323)
(uint32)PANIC(0x0144), // 0x0144 (324)
(uint32)PANIC(0x0145), // 0x0145 (325)
(uint32)PANIC(0x0146), // 0x0146 (326)
(uint32)PANIC(0x0147), // 0x0147 (327)
(uint32)PANIC(0x0148), // 0x0148 (328)
(uint32)PANIC(0x0149), // 0x0149 (329)
(uint32)PANIC(0x014A), // 0x014A (330)
(uint32)PANIC(0x014B), // 0x014B (331)
(uint32)PANIC(0x014C), // 0x014C (332)
(uint32)PANIC(0x014D), // 0x014D (333)
(uint32)PANIC(0x014E), // 0x014E (334)
(uint32)PANIC(0x014F), // 0x014F (335)
(uint32)PANIC(0x0150), // 0x0150 (336)
(uint32)PANIC(0x0151), // 0x0151 (337)
(uint32)PANIC(0x0152), // 0x0152 (338)
(uint32)PANIC(0x0153), // 0x0153 (339)
(uint32)PANIC(0x0154), // 0x0154 (340)
(uint32)PANIC(0x0155), // 0x0155 (341)
(uint32)PANIC(0x0156), // 0x0156 (342)
(uint32)PANIC(0x0157), // 0x0157 (343)
(uint32)PANIC(0x0158), // 0x0158 (344)
(uint32)PANIC(0x0159), // 0x0159 (345)
(uint32)PANIC(0x015A), // 0x015A (346)
(uint32)PANIC(0x015B), // 0x015B (347)
(uint32)PANIC(0x015C), // 0x015C (348)
(uint32)PANIC(0x015D), // 0x015D (349)
(uint32)PANIC(0x015E), // 0x015E (350)
(uint32)PANIC(0x015F), // 0x015F (351)
(uint32)PANIC(0x0160), // 0x0160 (352)
(uint32)PANIC(0x0161), // 0x0161 (353)
(uint32)PANIC(0x0162), // 0x0162 (354)
(uint32)PANIC(0x0163), // 0x0163 (355)
(uint32)PANIC(0x0164), // 0x0164 (356)
(uint32)PANIC(0x0165), // 0x0165 (357)
(uint32)PANIC(0x0166), // 0x0166 (358)
(uint32)PANIC(0x0167), // 0x0167 (359)
(uint32)PANIC(0x0168), // 0x0168 (360)
(uint32)PANIC(0x0169), // 0x0169 (361)
(uint32)PANIC(0x016A), // 0x016A (362)
(uint32)PANIC(0x016B), // 0x016B (363)
(uint32)PANIC(0x016C), // 0x016C (364)
(uint32)PANIC(0x016D), // 0x016D (365)
(uint32)PANIC(0x016E), // 0x016E (366)
};