Skip to content

Commit

Permalink
Merge pull request #17 from roblabla/fix-compilation
Browse files Browse the repository at this point in the history
Fix compilation
  • Loading branch information
roblabla authored Oct 10, 2023
2 parents 64a7bef + 71b992d commit e905370
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 29 deletions.
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,32 @@ TH06E_OBJS= $(OBJ_DIR)\main.obj \
all: $(OBJ_DIR)\th06e.exe

$(OBJ_DIR)\autogenerated\i18n.hpp: "$(SRC_DIR)\i18n.tpl"
-@if not exist "$(OBJ_DIR)\autogenerated" mkdir "$(OBJ_DIR)\autogenerated"
-@echo $(SRC_DIR)\i18n.tpl
-@$(PYTHON) -c "import sys; open(sys.argv[2], 'wb').write(open(sys.argv[1], 'rb').read().decode('utf8').encode('shift_jis'))" "$(SRC_DIR)\i18n.tpl" $@
@if not exist "$(OBJ_DIR)\autogenerated" mkdir "$(OBJ_DIR)\autogenerated"
@echo $(SRC_DIR)\i18n.tpl
@$(PYTHON) -c "import sys; open(sys.argv[2], 'wb').write(open(sys.argv[1], 'rb').read().decode('utf8').encode('shift_jis'))" "$(SRC_DIR)\i18n.tpl" $@

$(OBJ_DIR)\th06.res: "$(OBJ_DIR)\icon.ico"

"$(OBJ_DIR)":
-@if not exist "$(OBJ_DIR)/$(NULL)" mkdir "$(OBJ_DIR)"
@if not exist "$(OBJ_DIR)/$(NULL)" mkdir "$(OBJ_DIR)"

"$(OBJ_DIR)\icon.ico":
-@if exist "$(RES_DIR)\icon.ico" copy "$(RES_DIR)\icon.ico" "$(OBJ_DIR)\icon.ico"
-@if not exist "$(RES_DIR)\icon.ico" copy "$(RES_DIR)\placeholder.ico" "$(OBJ_DIR)\icon.ico"
@if exist "$(RES_DIR)\icon.ico" copy "$(RES_DIR)\icon.ico" "$(OBJ_DIR)\icon.ico"
@if not exist "$(RES_DIR)\icon.ico" copy "$(RES_DIR)\placeholder.ico" "$(OBJ_DIR)\icon.ico"

"$(OBJ_DIR)\th06e.exe": $(OBJ_DIR)\autogenerated\i18n.hpp $(OBJ_DIR) $(TH06E_OBJS)
-@$(LINK32) /out:$@ $(LINK32_FLAGS) /debug /pdb:"$(OBJ_DIR)\th06e.pdb" $(LINK32_LIBS) $(TH06E_OBJS)
@$(LINK32) /out:$@ $(LINK32_FLAGS) /debug /pdb:"$(OBJ_DIR)\th06e.pdb" $(LINK32_LIBS) $(TH06E_OBJS)

{$(SRC_DIR)}.cpp{$(OBJ_DIR)}.obj:
-@$(CPP) $(CFLAGS) /c $< /Fo$@
@$(CPP) $(CFLAGS) /c $< /Fo$@

{$(RES_DIR)}.rc{$(OBJ_DIR)}.res:
-@echo $<
-@$(RSC) /fo $@ $<
@echo $<
@$(RSC) /fo $@ $<

clean:
-@erase $(TH06E_OBJS) "$(OBJ_DIR)\th06e.exe" "$(OBJ_DIR)\th06e.pdb" "$(OBJ_DIR)\icon.ico" "$(OBJ_DIR)\autogenerated\i18n.hpp"
-@rmdir $(OBJ_DIR)\autogenerated
-@rmdir $(OBJ_DIR)
@erase $(TH06E_OBJS) "$(OBJ_DIR)\th06e.exe" "$(OBJ_DIR)\th06e.pdb" "$(OBJ_DIR)\icon.ico" "$(OBJ_DIR)\autogenerated\i18n.hpp"
@rmdir $(OBJ_DIR)\autogenerated
@rmdir $(OBJ_DIR)


2 changes: 2 additions & 0 deletions scripts/build.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
@echo off
call %CD%\scripts\th06vars.bat
nmake %*
if %errorlevel% neq 0 exit /b %errorlevel%
12 changes: 12 additions & 0 deletions scripts/create_devenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ def main(args: Namespace) -> int:
input_path / "python-3.4.4.msi",
"Missing installer for Python 3.4.4",
)
vcredist_installer_path = check_file(
input_path / "vcredist_x86.exe",
"Missing installer for Visual C++ 2010 Runtime",
)

program_files = output_path / "PROGRAM FILES"
program_files.mkdir(parents=True, exist_ok=True)
Expand Down Expand Up @@ -188,6 +192,14 @@ def main(args: Namespace) -> int:
shutil.move(tmp_dir, python_dst_dir)
shutil.rmtree(tmp_dir, ignore_errors=True)

print("Installing MSVCR100.DLL for Python")
shutil.rmtree(tmp_dir, ignore_errors=True)
tmp_dir.mkdir(parents=True, exist_ok=True)
run_generic_extract(vcredist_installer_path, tmp_dir)
run_generic_extract(tmp_dir / "vc_red.cab", tmp_dir)
shutil.move(tmp_dir / "F_CENTRAL_msvcr100_x86", python_dst_dir / "msvcr100.dll")
shutil.rmtree(tmp_dir, ignore_errors=True)

return 0


Expand Down
7 changes: 7 additions & 0 deletions scripts/download_requirements
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ VS_02_URL="$ARCHIVE_DOWNLOAD_BASE_URL/en_vs.net_pro_full/$VS_02_FILE_NAME"
PYTHON_FILE_NAME="python-3.4.4.msi"
PYTHON_URL="https://www.python.org/ftp/python/3.4.4/$PYTHON_FILE_NAME"

MSVCR100_FILE_NAME="vcredist_x86.exe"
MSVCR100_URL="https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/$MSVCR100_FILE_NAME"

mkdir -p $DL_PATH
pushd $DL_PATH
if [[ ! -e $DX8_FILE_NAME ]]; then
Expand All @@ -30,4 +33,8 @@ if [[ ! -e $PYTHON_FILE_NAME ]]; then
echo "Downloading Python 3.4.4"
curl -L -O $PYTHON_URL
fi
if [[ ! -e $MSVCR100_FILE_NAME ]]; then
echo "Downloading Visual C++ 10.0 Runtime"
curl -L -O $MSVCR100_URL
fi
popd
9 changes: 9 additions & 0 deletions scripts/download_requirements.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$ErrorActionPreference = "Stop"

$client = New-Object System.Net.WebClient

$ARCHIVE_DOWNLOAD_BASE_URL="https://archive.org/download"
Expand All @@ -10,6 +12,9 @@ $VS_02_URL="$ARCHIVE_DOWNLOAD_BASE_URL/en_vs.net_pro_full/$VS_02_FILE_NAME"
$PYTHON_FILE_NAME="python-3.4.4.msi"
$PYTHON_URL="https://www.python.org/ftp/python/3.4.4/$PYTHON_FILE_NAME"

$MSVCR100_FILE_NAME="vcredist_x86.exe"
$MSVCR100_URL="https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/$MSVCR100_FILE_NAME"

$SCRIPT_DIR=$PSScriptRoot
$DL_PATH="$SCRIPT_DIR/dls"

Expand All @@ -28,3 +33,7 @@ if (!(Test-Path "$DL_PATH/$PYTHON_FILE_NAME")) {
Write-Host "Downloading Python 3.4.4"
$client.DownloadFile($PYTHON_URL, "$DL_PATH/$PYTHON_FILE_NAME")
}
if (!(Test-Path "$DL_PATH/$MSVCR100_FILE_NAME")) {
Write-Host "Downloading Visual C++ 10.0 Runtime"
$client.DownloadFile($MSVCR100_URL, "$DL_PATH/$MSVCR100_FILE_NAME")
}
10 changes: 5 additions & 5 deletions src/Chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ChainElem::ChainElem()
flags &= CHAIN_ELEM_FLAG_MASK;
}

ChainElem::ChainElem()
ChainElem::~ChainElem()
{
if (deletedCallback != NULL)
{
Expand Down Expand Up @@ -146,11 +146,11 @@ void Chain::Cut(ChainElem *to_remove)
destroy_elem:
if (!isDrawChain)
{
DebugPrint2("calc cut Chain (Pri = %d)¥n", to_remove->priority);
DebugPrint2("calc cut Chain (Pri = %d)\n", to_remove->priority);
}
else
{
DebugPrint2("draw cut Chain (Pri = %d)¥n", to_remove->priority);
DebugPrint2("draw cut Chain (Pri = %d)\n", to_remove->priority);
}

if (to_remove->prev != NULL)
Expand Down Expand Up @@ -296,7 +296,7 @@ int Chain::AddToCalcChain(ChainElem *elem, int priority)
ChainElem *cur;

cur = &this->calcChain;
DebugPrint2("add calc chain (pri = %d)¥n", priority);
DebugPrint2("add calc chain (pri = %d)\n", priority);
elem->priority = priority;

while (cur->next != NULL)
Expand Down Expand Up @@ -346,7 +346,7 @@ int Chain::AddToDrawChain(ChainElem *elem, int priority)
ChainElem *cur;

cur = &this->drawChain;
DebugPrint2("add draw chain (pri = %d)¥n", priority);
DebugPrint2("add draw chain (pri = %d)\n", priority);
elem->priority = priority;

while (cur->next != NULL)
Expand Down
6 changes: 3 additions & 3 deletions src/Chain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
enum ChainElemFlag
{
CHAIN_ELEM_FLAG_HEAP_ALLOCATED = (unsigned char)1,
CHAIN_ELEM_FLAG_MASK = (unsigned char)CHAIN_ELEM_FLAG_HEAP_ALLOCATED,
CHAIN_ELEM_FLAG_MASK = ~(unsigned char)CHAIN_ELEM_FLAG_HEAP_ALLOCATED,
};

enum ChainCallbackResult
Expand Down Expand Up @@ -38,7 +38,7 @@ class ChainElem
void *arg;

ChainElem();
ChainElem();
~ChainElem();

ChainElem *Allocate(ChainCallback callback);
};
Expand All @@ -61,7 +61,7 @@ class Chain
unk = 0;
}

Chain()
~Chain()
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/GameContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ u16 GetControllerInput(u16 buttons)
{
i32 retryCount = 0;

DebugPrint2("error : DIERR_INPUTLOST¥n");
DebugPrint2("error : DIERR_INPUTLOST\n");
aaa = g_GameContext.controller->Acquire();

while (aaa == DIERR_INPUTLOST)
{
aaa = g_GameContext.controller->Acquire();
DebugPrint2("error : DIERR_INPUTLOST %d¥n", retryCount);
DebugPrint2("error : DIERR_INPUTLOST %d\n", retryCount);

retryCount++;

Expand Down
6 changes: 3 additions & 3 deletions src/GameErrorContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ class GameErrorContext
GameErrorContext()
{
m_BufferEnd = m_Buffer;
m_Buffer[0] = '¥0';
m_Buffer[0] = '\0';
// Required to get some mov eax, [m_Buffer_ptr]
m_ShowMessageBox = false;
GameErrorContextLog(this, TH_ERR_LOGGER_END);
}

GameErrorContext()
~GameErrorContext()
{
}

void RstContext()
{
m_BufferEnd = m_Buffer;
m_Buffer[0] = '¥0';
m_Buffer[0] = '\0';
}

void Flush();
Expand Down
2 changes: 1 addition & 1 deletion src/VeryBigStruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
VeryBigStruct::VeryBigStruct()
{
}
VeryBigStruct::VeryBigStruct()
VeryBigStruct::~VeryBigStruct()
{
}
void VeryBigStruct::ReleaseD3dSurfaces(void)
Expand Down
2 changes: 1 addition & 1 deletion src/VeryBigStruct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
struct VeryBigStruct
{
VeryBigStruct();
VeryBigStruct();
~VeryBigStruct();

void ReleaseD3dSurfaces(void);
char data[0x2112c];
Expand Down
2 changes: 1 addition & 1 deletion src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ void DebugPrint2(const char *fmt, ...)
vsprintf(tmpBuffer, fmt, args);
va_end(args, fmt);

printf("DEBUG2: %s¥n", tmpBuffer);
printf("DEBUG2: %s\n", tmpBuffer);
#endif
}

0 comments on commit e905370

Please sign in to comment.