diff --git a/.github/docs/truecrimenyc.md b/.github/docs/truecrimenyc.md index bb4beebc5..65a20403a 100644 --- a/.github/docs/truecrimenyc.md +++ b/.github/docs/truecrimenyc.md @@ -1,4 +1,4 @@ -![truecrimenyc](https://thirteenag.github.io/screens/truecrimenyc/main2.jpg) +![truecrimenyc](http://thirteenag.github.io/screens/truecrimenyc/main2.jpg) ![](https://habrastorage.org/webt/ow/yy/mg/owyymgpibfqzfbwyf_iqoiqrede.png) Fixed Resolution @@ -10,9 +10,28 @@ ![](https://habrastorage.org/webt/ow/yy/mg/owyymgpibfqzfbwyf_iqoiqrede.png) Fixed FMVs - Installation: - Download and extract the archive to the game directory, where the exe is located. +## **PCSX2F: True Crime New York City Widescreen Fix (BETA):** -[Website](https://thirteenag.github.io/wfp#truecrimenyc) | [Source](https://github.com/ThirteenAG/WidescreenFixesPack/blob/master/source/TrueCrimeNewYorkCity.WidescreenFix/dllmain.cpp) | [Default INI File](https://github.com/ThirteenAG/WidescreenFixesPack/blob/master/data/TrueCrimeNewYorkCity.WidescreenFix/scripts/TrueCrimeNewYorkCity.WidescreenFix.ini) +One version of the game is compatible, **SLUS-21106** (crc: **42A9C4EC**). -



\ No newline at end of file +Installation: + +- Download and extract [PCSX2 Fork With Plugins](https://github.com/ASI-Factory/PCSX2-Fork-With-Plugins/releases/tag/latest). +- Download and extract plugin archive to the root directory, where exe is located. +- Change the aspect ratio or window size of the emulator. +- Launch the game. +- Do **not** set native widescreen option to ON. + +This plugin is a backport from pc version, and it's untested. + +![](https://habrastorage.org/webt/ow/yy/mg/owyymgpibfqzfbwyf_iqoiqrede.png) Fixed Aspect Ratio + +![](https://habrastorage.org/webt/ow/yy/mg/owyymgpibfqzfbwyf_iqoiqrede.png) Fixed HUD + +![](https://habrastorage.org/webt/ow/yy/mg/owyymgpibfqzfbwyf_iqoiqrede.png) Fixed Field of View + +![truecrimenycpcsx2f](https://github.com/ThirteenAG/WidescreenFixesPack/assets/4904157/085e488d-957e-4827-9ad4-5459861ef5db) +![truecrimenycpcsx2f](https://github.com/ThirteenAG/WidescreenFixesPack/assets/4904157/9d76f723-fca3-4d38-887f-5cf0d4f05045) + + +[Website](http://thirteenag.github.io/wfp#truecrimenyc) | [Source](https://github.com/ThirteenAG/WidescreenFixesPack/blob/master/source/TrueCrimeNewYorkCity.WidescreenFix/dllmain.cpp) | [Default INI File](https://github.com/ThirteenAG/WidescreenFixesPack/blob/master/data/TrueCrimeNewYorkCity.WidescreenFix/scripts/TrueCrimeNewYorkCity.WidescreenFix.ini) \ No newline at end of file diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 8accc8546..fcde14fad 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -636,7 +636,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} tag_list: ${{ format('{0},{1}', github.event.inputs.tag_list, inputs.tag_list) }} tag: truecrimenyc - artifacts: data/Archives/TrueCrimeNewYorkCity.WidescreenFix.zip + artifacts: data/Archives/TrueCrimeNewYorkCity.WidescreenFix.zip, data/Archives/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix.zip - name: Stubbs the Zombie Widescreen Fix uses: ./.github/workflows/release_tag diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index b03ff1987..b2af7031e 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -194,7 +194,7 @@ env: thug: "/t:TonyHawksUnderground_WidescreenFix" thug2: "/t:TonyHawksUnderground2_WidescreenFix" tod: "/t:TotalOverdose_WidescreenFix" - truecrimenyc: "/t:TrueCrimeNewYorkCity_WidescreenFix" + truecrimenyc: "/t:TrueCrimeNewYorkCity_WidescreenFix /t:TrueCrimeNewYorkCity_PCSX2F_WidescreenFix" truecrimesola: "/t:TrueCrimeStreetsofLA_WidescreenFix" xrd: "/t:PPSSPP_XboxRainDroplets /t:PCSX2F_XboxRainDroplets" usm: "/t:UltimateSpiderMan_WidescreenFix" diff --git a/data/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix/PLUGINS/.gitkeep b/data/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix/PLUGINS/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/premake5.lua b/premake5.lua index e47a729f0..58a33500f 100644 --- a/premake5.lua +++ b/premake5.lua @@ -239,7 +239,7 @@ project "Assembly64.TestApp" targetextension ".exe" platforms { "Win64" } architecture "x64" - setpaths("./data/%{prj.name}", "%{prj.name}.exe", "") + setpaths("./data/%{prj.name}/", "%{prj.name}.exe", "") project "Assembly64.TestAsi" platforms { "Win64" } architecture "x64" @@ -648,6 +648,18 @@ project "TotalOverdose.WidescreenFix" setpaths("Z:/WFP/Games/Total Overdose/", "TOD.exe") project "TrueCrimeNewYorkCity.WidescreenFix" setpaths("Z:/WFP/Games/True Crime New York City/", "True Crime New York City.exe") +project "TrueCrimeNewYorkCity.PCSX2F.WidescreenFix" + kind "Makefile" + dependson { "SplinterCellDoubleAgent.PCSX2F.WidescreenFix" } + includedirs { "external/ps2sdk/ps2sdk/ee" } + files { "source/%{prj.name}/*.h" } + files { "source/%{prj.name}/*.c", "source/%{prj.name}/makefile" } + targetextension ".elf" + setbuildpaths_ps2("Z:/GitHub/PCSX2-Fork-With-Plugins/bin/", "pcsx2x64.exe", "PLUGINS/", "%{wks.location}/../external/ps2sdk/ee/bin/vsmake.ps1", "%{wks.location}/../source/%{prj.name}/", "TrueCrimeNewYorkCity.PCSX2F.WidescreenFix") + writemakefile_ps2("TrueCrimeNewYorkCity.PCSX2F.WidescreenFix", "PLUGINS/", "0x02100000", "-l:libc.a -l:libm.a -l:libgcc.a", "../../includes/pcsx2/log.o", + "../../includes/pcsx2/memalloc.o", "../../includes/pcsx2/patterns.o", "../../includes/pcsx2/injector.o", "../../includes/pcsx2/rini.o", + "../../includes/pcsx2/inireader.o", "../../includes/pcsx2/mips.o") + writelinkfile_ps2("TrueCrimeNewYorkCity.PCSX2F.WidescreenFix") project "TrueCrimeStreetsofLA.WidescreenFix" setpaths("Z:/WFP/Games/True Crime Streets of LA/", "TrueCrimeMB.exe") project "UltimateSpiderMan.WidescreenFix" diff --git a/source/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix/main.c b/source/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix/main.c new file mode 100644 index 000000000..4535d0274 --- /dev/null +++ b/source/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix/main.c @@ -0,0 +1,170 @@ +#include +#include +#include + +#include "../../includes/pcsx2/pcsx2f_api.h" +#include "../../includes/pcsx2/log.h" +#include "../../includes/pcsx2/injector.h" +#include "../../includes/pcsx2/inireader.h" +#include "../../includes/pcsx2/patterns.h" + +int CompatibleCRCList[] = { 0x42A9C4EC }; +int CompatibleElfCRCList[] = { 0x42A9C4EC, 0x1118ACD0 }; +int PCSX2Data[PCSX2Data_Size] = { 1 }; +char OSDText[OSDStringNum][OSDStringSize] = { {1} }; +char PluginData[MaxIniSize] = { 1 }; + +struct ScreenX +{ + int32_t nWidth; + int32_t nHeight; + float fWidth; + float fHeight; + float fAspectRatio; + float f3DScale; + float fHudScale; + float fHudOffset; +} Screen; + +void __fastcall HudScaleX(int a1, int a2) +{ + if (a2 == 640) + a2 = (int)(640.0f * Screen.fHudScale); + + *(int*)(a1 + 0xD0) = a2; + *(float*)(a1 + 0xD8) = (float)a2 * 0.0015625f; + *(float*)(a1 + 0xE0) = 1.0 / (float)a2; +} + +void init() +{ + //logger.SetBuffer(OSDText, sizeof(OSDText) / sizeof(OSDText[0]), sizeof(OSDText[0])); + //logger.Write("Loading TrueCrimeNewYorkCity.PCSX2F.WidescreenFix..."); + + inireader.SetIniPath((char*)PluginData + sizeof(uint32_t), *(uint32_t*)PluginData); + + int SkipIntro = inireader.ReadInteger("MAIN", "SkipIntro", 1); + + if (SkipIntro) + { + uintptr_t ptr_100350 = pattern.get(0, "2D 20 40 02 ? ? ? ? 2D 40 20 02", -4); + + if (ptr_100350 != 0) + { + //logger.Write("Skipping intro..."); + injector.MakeNOP(ptr_100350); + return; + } + } + + uint32_t DesktopSizeX = PCSX2Data[PCSX2Data_DesktopSizeX]; + uint32_t DesktopSizeY = PCSX2Data[PCSX2Data_DesktopSizeY]; + Screen.nWidth = PCSX2Data[PCSX2Data_WindowSizeX]; + Screen.nHeight = PCSX2Data[PCSX2Data_WindowSizeY]; + Screen.fWidth = (float)Screen.nWidth; + Screen.fHeight = (float)Screen.nHeight; + uint32_t IsFullscreen = PCSX2Data[PCSX2Data_IsFullscreen]; + uint32_t AspectRatioSetting = PCSX2Data[PCSX2Data_AspectRatioSetting]; + + if (IsFullscreen || !Screen.nWidth || !Screen.nHeight) + { + Screen.nWidth = DesktopSizeX; + Screen.nHeight = DesktopSizeY; + } + + switch (AspectRatioSetting) + { + case RAuto4_3_3_2: //not implemented + //if (GSgetDisplayMode() == GSVideoMode::SDTV_480P) + // AspectRatio = 3.0f / 2.0f; + //else + Screen.fAspectRatio = 4.0f / 3.0f; + break; + case R4_3: + Screen.fAspectRatio = 4.0f / 3.0f; + break; + case R16_9: + Screen.fAspectRatio = 16.0f / 9.0f; + break; + case Stretch: + default: + Screen.fAspectRatio = Screen.fWidth / Screen.fHeight; + break; + } + + //logger.WriteF("Resolution: %dx%d", Screen.nWidth, Screen.nHeight); + //logger.WriteF("Aspect Ratio: %f", Screen.fAspectRatio); + + float intResX = 640.0f; + float intResY = 480.0f; + + Screen.fHudScale = (((intResX / intResY)) / (Screen.fAspectRatio)); + Screen.fHudOffset = (1.0f / (448.0f * (4.0f / 3.0f))) * (((448.0f * Screen.fAspectRatio) - 448.0f * (4.0f / 3.0f)) / 2.0f); + Screen.f3DScale = (((intResX / intResY)) / (Screen.fAspectRatio)); + + //3D Scaling + injector.MakeInlineLUIORI(0x01D97FC, 0.0015625f * Screen.fHudScale); // 3d + injector.MakeInlineLUIORI(0x0204DD8, 0.0015625f * Screen.fHudScale); // or this + + //Hud Scaling + //injector.MakeInlineLUIORI(0x020BA4C, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x02346FC, 0.0015625f * Screen.fHudScale); // ui 1 + //injector.MakeInlineLUIORI(0x023830C, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x023AF68, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x023B4D8, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x023E524, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x02432EC, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x02434E8, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0243B00, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0244214, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x024422C, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x02442E0, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0244628, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x02447E8, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0244B18, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0247D58, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0247DA8, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0248210, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0248774, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x02EDDF4, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0318A78, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0325ABC, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x03F3964, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x0449CAC, 0.0015625f * Screen.fHudScale); + //injector.MakeInlineLUIORI(0x04A3AFC, 0.0015625f * Screen.fHudScale); + + // Hud Pos + float f = Screen.fHudOffset; + MakeInlineWrapperWithNOP(0x233DA4, + lui(v0, HIWORD(f)), + ori(v0, v0, LOWORD(f)), + sw(v0, sp, 0x24) + ); + + injector.MakeJAL(0x204E74, (uintptr_t)HudScaleX); + injector.MakeJAL(0x233644, (uintptr_t)HudScaleX); + injector.MakeJAL(0x2336F4, (uintptr_t)HudScaleX); + injector.MakeJAL(0x23389C, (uintptr_t)HudScaleX); + injector.MakeJAL(0x2346AC, (uintptr_t)HudScaleX); // ui stretch + injector.MakeJAL(0x234990, (uintptr_t)HudScaleX); + injector.MakeJAL(0x2349CC, (uintptr_t)HudScaleX); + injector.MakeJAL(0x2349EC, (uintptr_t)HudScaleX); + injector.MakeJAL(0x255C58, (uintptr_t)HudScaleX); + injector.MakeJAL(0x26FBF8, (uintptr_t)HudScaleX); + injector.MakeJAL(0x270338, (uintptr_t)HudScaleX); + injector.MakeJAL(0x2752A8, (uintptr_t)HudScaleX); + injector.MakeJAL(0x275330, (uintptr_t)HudScaleX); //background ui + injector.MakeJAL(0x2C0690, (uintptr_t)HudScaleX); + injector.MakeJAL(0x2C0BA8, (uintptr_t)HudScaleX); + injector.MakeJAL(0x49FE6C, (uintptr_t)HudScaleX); + injector.MakeJAL(0x49FEB8, (uintptr_t)HudScaleX); + + + //logger.Write("TrueCrimeNewYorkCity.PCSX2F.WidescreenFix loaded"); + //logger.ClearLog(); +} + +int main() +{ + return 0; +} diff --git a/source/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix/makefile b/source/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix/makefile new file mode 100644 index 000000000..c21e937e3 --- /dev/null +++ b/source/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix/makefile @@ -0,0 +1,22 @@ +EE_BIN = ../../data/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix/PLUGINS/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix.elf +EE_OBJS = main.o ../../includes/pcsx2/log.o ../../includes/pcsx2/memalloc.o ../../includes/pcsx2/patterns.o ../../includes/pcsx2/injector.o ../../includes/pcsx2/rini.o ../../includes/pcsx2/inireader.o ../../includes/pcsx2/mips.o + +CFLAGS = -O0 -Os -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division -fpack-struct=16 +CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti +ASFLAGS = $(CFLAGS) + +BASE_ADDRESS = 0x02100000 +EE_LINKFILE = linkfile +EE_LIBS += -l:libc.a -l:libm.a -l:libgcc.a +EE_LDFLAGS = -Wl,--entry=init -Wl,-Map,../../data/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix/PLUGINS/TrueCrimeNewYorkCity.PCSX2F.WidescreenFix.map -Wl,-exclude-libs,ALL -Wl,'--defsym=BASE_ADDRESS=$(BASE_ADDRESS)' + +all: clean main-build + +main-build: $(EE_BIN) + +clean: + rm -f $(EE_OBJS) $(EE_BIN) + +PS2SDK = ../../external/ps2sdk/ps2sdk +include $(PS2SDK)/samples/Makefile.pref +include $(PS2SDK)/samples/Makefile.eeglobal