Skip to content

Commit

Permalink
Merge pull request #14 from roblabla/no-more-shift-jis
Browse files Browse the repository at this point in the history
No more shift jis
  • Loading branch information
roblabla authored Sep 29, 2023
2 parents 0d8c420 + 411e679 commit 9f25204
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 18 deletions.
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
CPP=cl.exe
LINK32=link.exe
RSC=rc.exe
PYTHON=python.exe

CFLAGS=/nologo /MT /EHsc /G5 /GS /Od /Oi /Ob1 /DNDEBUG /Zi
LINK32_BASE_LIBS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
LINK32_LIBS=dxguid.lib d3dx8.lib d3d8.lib winmm.lib $(LINK32_BASE_LIBS)
LINK32_FLAGS=/nologo /subsystem:windows /machine:X86 /filealign:4096 /incremental:no
Expand All @@ -15,6 +15,8 @@ OBJ_DIR=build
RES_DIR=resources
SRC_DIR=src

CFLAGS=/nologo /MT /EHsc /G5 /GS /Od /Oi /Ob1 /DNDEBUG /Zi /I $(OBJ_DIR)\autogenerated

.SUFFIXES : .cpp .obj

TH06E_OBJS= $(OBJ_DIR)\main.obj \
Expand All @@ -30,6 +32,11 @@ 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" $@

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

"$(OBJ_DIR)":
Expand All @@ -39,7 +46,7 @@ $(OBJ_DIR)\th06.res: "$(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) $(TH06E_OBJS)
"$(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)

{$(SRC_DIR)}.cpp{$(OBJ_DIR)}.obj:
Expand All @@ -50,7 +57,8 @@ $(OBJ_DIR)\th06.res: "$(OBJ_DIR)\icon.ico"
-@$(RSC) /fo $@ $<

clean:
-@erase $(TH06E_OBJS) "$(OBJ_DIR)\th06e.exe" "$(OBJ_DIR)\th06e.pdb" "$(OBJ_DIR)\icon.ico"
-@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)


12 changes: 12 additions & 0 deletions scripts/create_devenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def main(args: Namespace) -> int:
input_path / "en_vs.net_pro_full.exe",
"Missing installer for Visual Studio .NET 2002 Professional Edition",
)
python_installer_path = check_file(
input_path / "python-3.4.4.msi",
"Missing installer for Python 3.4.4",
)

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

print("Installing Python")
shutil.rmtree(tmp_dir, ignore_errors=True)
tmp_dir.mkdir(parents=True, exist_ok=True)
msiextract(python_installer_path, tmp_dir)
python_dst_dir = output_path / "python"
shutil.move(tmp_dir, python_dst_dir)
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 @@ -12,6 +12,9 @@ DX8_URL="$ARCHIVE_DOWNLOAD_BASE_URL/dx8sdk/$DX8_FILE_NAME"
VS_02_FILE_NAME="en_vs.net_pro_full.exe"
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"

mkdir -p $DL_PATH
pushd $DL_PATH
if [[ ! -e $DX8_FILE_NAME ]]; then
Expand All @@ -23,4 +26,8 @@ if [[ ! -e $VS_02_FILE_NAME ]]; then
echo "Downloading Visual Studio .NET 2002 Professional Edition"
curl -L -O $VS_02_URL
fi
if [[ ! -e $PYTHON_FILE_NAME ]]; then
echo "Downloading Python 3.4.4"
curl -L -O $PYTHON_URL
fi
popd
7 changes: 7 additions & 0 deletions scripts/download_requirements.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ $DX8_URL="$ARCHIVE_DOWNLOAD_BASE_URL/dx8sdk/$DX8_FILE_NAME"
$VS_02_FILE_NAME="en_vs.net_pro_full.exe"
$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"

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

Expand All @@ -21,3 +24,7 @@ if (!(Test-Path "$DL_PATH/$VS_02_FILE_NAME")) {
Write-Host "Downloading Visual Studio 2002"
$client.DownloadFile($VS_02_URL, "$DL_PATH/$VS_02_FILE_NAME")
}
if (!(Test-Path "$DL_PATH/$PYTHON_FILE_NAME")) {
Write-Host "Downloading Python 3.4.4"
$client.DownloadFile($PYTHON_URL, "$DL_PATH/$PYTHON_FILE_NAME")
}
3 changes: 2 additions & 1 deletion scripts/th06vars.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
@SET VS_BASE_PATH=%DEVENV_PREFIX%\Program Files\MICROSOFT VISUAL STUDIO .NET
@SET MS_VC_PATH=%VS_BASE_PATH%\VC7
@SET DXSDK_DIR=%DEVENV_PREFIX%\mssdk
@SET PY_PATH=%DEVENV_PREFIX%\python

@SET PATH=%MS_VC_PATH%\Bin;%VS_BASE_PATH%\FrameworkSDK\Bin;%VS_BASE_PATH%\Common7\IDE;%PATH%
@SET PATH=%PY_PATH%;%MS_VC_PATH%\Bin;%VS_BASE_PATH%\FrameworkSDK\Bin;%VS_BASE_PATH%\Common7\IDE;%PATH%
@SET INCLUDE=%DXSDK_DIR%\include;%MS_VC_PATH%\INCLUDE;%MS_VC_PATH%\PlatformSDK\include\prerelease;%MS_VC_PATH%\PlatformSDK\include;%MS_VC_PATH%\PlatformSDK\common\include\prerelease;%MS_VC_PATH%\PlatformSDK\common\include
@SET LIB=%DXSDK_DIR%\lib;%MS_VC_PATH%\LIB;%MS_VC_PATH%\PlatformSDK\lib\prerelease;%MS_VC_PATH%\PlatformSDK\lib;%MS_VC_PATH%\PlatformSDK\common\lib\prerelease;%MS_VC_PATH%\PlatformSDK\common\lib;%MS_VC_PATH%\PlatformSDK\x86\lib

Expand Down
24 changes: 12 additions & 12 deletions src/i18n.hpp → src/i18n.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
// JP
#define TH_JP_CONFIG_FILE "東方紅魔郷.cfg"
#define TH_JP_WINDOW_TITLE "東方紅魔郷 〜 the Embodiment of Scarlet Devil"
#define TH_JP_ERR_ALREADY_RUNNING "二つは起動できません¥n"
#define TH_JP_ERR_D3D_ERR_COULD_NOT_CREATE_OBJ "Direct3D オブジェクトは何故か作成出来なかった¥n"
#define TH_JP_ERR_LOGGER_START "東方動作記録 --------------------------------------------- ¥n"
#define TH_JP_ERR_LOGGER_END "---------------------------------------------------------- ¥n"
#define TH_JP_ERR_NO_PAD_FOUND "使えるパッドが存在しないようです、残念¥n"
#define TH_JP_ERR_OPTION_CHANGED_RESTART "再起動を要するオプションが変更されたので再起動します¥n"
#define TH_JP_ERR_ALREADY_RUNNING "二つは起動できません\n"
#define TH_JP_ERR_D3D_COULD_NOT_CREATE_OBJ "Direct3D オブジェクトは何故か作成出来なかった\n"
#define TH_JP_ERR_LOGGER_START "東方動作記録 --------------------------------------------- \n"
#define TH_JP_ERR_LOGGER_END "---------------------------------------------------------- \n"
#define TH_JP_ERR_NO_PAD_FOUND "使えるパッドが存在しないようです、残念\n"
#define TH_JP_ERR_OPTION_CHANGED_RESTART "再起動を要するオプションが変更されたので再起動します\n"

// EN
#define TH_EN_CONFIG_FILE "th06.cfg"
#define TH_EN_WINDOW_TITLE "Touhou Koumakyou 〜 the Embodiment of Scarlet Devil"
#define TH_EN_ERR_ALREADY_RUNNING "Touhou cannot be started¥n"
#define TH_EN_ERR_D3D_COULD_NOT_CREATE_OBJ "Direct3D object could not be created for some reason¥n"
#define TH_EN_ERR_LOGGER_START "Logger started --------------------------------------------- ¥n"
#define TH_EN_ERR_LOGGER_END "---------------------------------------------------------- ¥n"
#define TH_EN_ERR_NO_PAD_FOUND "Unfortunately, there doesn't seem to be a pad that can be used.¥n"
#define TH_EN_ERR_OPTION_CHANGED_RESTART "An option that requires a restart has been changed¥n"
#define TH_EN_ERR_ALREADY_RUNNING "Touhou cannot be started\n"
#define TH_EN_ERR_D3D_COULD_NOT_CREATE_OBJ "Direct3D object could not be created for some reason\n"
#define TH_EN_ERR_LOGGER_START "Logger started --------------------------------------------- \n"
#define TH_EN_ERR_LOGGER_END "---------------------------------------------------------- \n"
#define TH_EN_ERR_NO_PAD_FOUND "Unfortunately, there doesn't seem to be a pad that can be used.\n"
#define TH_EN_ERR_OPTION_CHANGED_RESTART "An option that requires a restart has been changed.\n"

#define TH_CONCAT_HELPER(x, y) x##y

Expand Down

0 comments on commit 9f25204

Please sign in to comment.