From 7c5c2fafb736b873eacc996b418605b0c684b983 Mon Sep 17 00:00:00 2001 From: asesidaa <1061472754@qq.com> Date: Thu, 23 Feb 2023 01:15:53 +0800 Subject: [PATCH] Minor fixes and prepare for release --- Application/Application.csproj | 1 + Application/DependencyInjection.cs | 6 +- Application/Game/Card/Read/ReadAvatarQuery.cs | 2 +- .../Game/Card/Read/ReadNavigatorQuery.cs | 2 +- ...TenpoIdJob.cs => MaintainNullValuesJob.cs} | 17 ++- GC-local-server-rewrite.sln | 6 - MainServer/.config/dotnet-tools.json | 12 ++ MainServer/MainServer.csproj | 4 +- WebUI/WebUI.csproj | 4 + WebUI/wwwroot/sample-data/weather.json | 27 ---- doc/Certifications.md | 134 ++++++++++++++++++ 11 files changed, 169 insertions(+), 46 deletions(-) rename Application/Jobs/{MaintainTenpoIdJob.cs => MaintainNullValuesJob.cs} (63%) create mode 100644 MainServer/.config/dotnet-tools.json delete mode 100644 WebUI/wwwroot/sample-data/weather.json create mode 100644 doc/Certifications.md diff --git a/Application/Application.csproj b/Application/Application.csproj index 5d3eb55..d86fa22 100644 --- a/Application/Application.csproj +++ b/Application/Application.csproj @@ -19,6 +19,7 @@ + diff --git a/Application/DependencyInjection.cs b/Application/DependencyInjection.cs index c44065d..915b0b3 100644 --- a/Application/DependencyInjection.cs +++ b/Application/DependencyInjection.cs @@ -56,11 +56,11 @@ public static class DependencyInjection }); }); - q.AddJob(options => options.WithIdentity(MaintainTenpoIdJob.KEY)); + q.AddJob(options => options.WithIdentity(MaintainNullValuesJob.KEY)); q.AddTrigger(options => { - options.ForJob(MaintainTenpoIdJob.KEY) - .WithIdentity("MaintainTenpoIdJob-trigger") + options.ForJob(MaintainNullValuesJob.KEY) + .WithIdentity("MaintainNullValuesJob-trigger") .StartNow() .WithSimpleSchedule(x => { diff --git a/Application/Game/Card/Read/ReadAvatarQuery.cs b/Application/Game/Card/Read/ReadAvatarQuery.cs index ab328e0..0087422 100644 --- a/Application/Game/Card/Read/ReadAvatarQuery.cs +++ b/Application/Game/Card/Read/ReadAvatarQuery.cs @@ -25,7 +25,7 @@ public class ReadAvatarQueryHandler : RequestHandlerBase logger; + private readonly ILogger logger; private readonly ICardDbContext cardDbContext; - public static readonly JobKey KEY = new("MaintainTenpoIdJob"); + public static readonly JobKey KEY = new("MaintainNullValuesJob"); - public MaintainTenpoIdJob(ILogger logger, ICardDbContext cardDbContext) + public MaintainNullValuesJob(ILogger logger, ICardDbContext cardDbContext) { this.logger = logger; this.cardDbContext = cardDbContext; @@ -26,8 +26,13 @@ public class MaintainTenpoIdJob : IJob logger.LogInformation("Starting changing null values in card detail table"); var details = await cardDbContext.CardDetails.Where(detail => detail.LastPlayTenpoId == null || - detail.LastPlayTenpoId == "GC local server").ToListAsync(); - details.ForEach(detail => detail.LastPlayTenpoId="1337"); + detail.LastPlayTenpoId == "GC local server" + || detail.LastPlayTime == null).ToListAsync(); + details.ForEach(detail => + { + detail.LastPlayTenpoId = "1337"; + detail.LastPlayTime = DateTime.MinValue; + }); cardDbContext.CardDetails.UpdateRange(details); var count = await cardDbContext.SaveChangesAsync(new CancellationToken()); diff --git a/GC-local-server-rewrite.sln b/GC-local-server-rewrite.sln index 1eb288c..887445e 100644 --- a/GC-local-server-rewrite.sln +++ b/GC-local-server-rewrite.sln @@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GC-local-server-rewrite", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedProject", "SharedProject\SharedProject.csproj", "{C01D0576-9D4E-4535-8055-C4905433A1EB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MudAdmin", "MudAdmin\MudAdmin.csproj", "{DC8E30E9-F81E-4E28-A4D2-F4576C77FFBE}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GCRelayServer", "GCRelayServer\GCRelayServer.csproj", "{268178DF-6345-4D9E-A389-9E809CBF39C9}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatchServer", "MatchServer\MatchServer.csproj", "{CB91C3D3-ED69-4DC6-A205-B262A08BEE49}" @@ -39,10 +37,6 @@ Global {C01D0576-9D4E-4535-8055-C4905433A1EB}.Debug|Any CPU.Build.0 = Debug|Any CPU {C01D0576-9D4E-4535-8055-C4905433A1EB}.Release|Any CPU.ActiveCfg = Release|Any CPU {C01D0576-9D4E-4535-8055-C4905433A1EB}.Release|Any CPU.Build.0 = Release|Any CPU - {DC8E30E9-F81E-4E28-A4D2-F4576C77FFBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DC8E30E9-F81E-4E28-A4D2-F4576C77FFBE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DC8E30E9-F81E-4E28-A4D2-F4576C77FFBE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DC8E30E9-F81E-4E28-A4D2-F4576C77FFBE}.Release|Any CPU.Build.0 = Release|Any CPU {268178DF-6345-4D9E-A389-9E809CBF39C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {268178DF-6345-4D9E-A389-9E809CBF39C9}.Debug|Any CPU.Build.0 = Debug|Any CPU {268178DF-6345-4D9E-A389-9E809CBF39C9}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/MainServer/.config/dotnet-tools.json b/MainServer/.config/dotnet-tools.json new file mode 100644 index 0000000..6b93cca --- /dev/null +++ b/MainServer/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "7.0.3", + "commands": [ + "dotnet-ef" + ] + } + } +} \ No newline at end of file diff --git a/MainServer/MainServer.csproj b/MainServer/MainServer.csproj index ce904ef..0d13644 100644 --- a/MainServer/MainServer.csproj +++ b/MainServer/MainServer.csproj @@ -94,14 +94,14 @@ - - + + <_ContentIncludedByDefault Remove="wwwroot\_framework\blazor.boot.json" /> <_ContentIncludedByDefault Remove="wwwroot\_framework\blazor.webassembly.js" /> <_ContentIncludedByDefault Remove="wwwroot\_framework\blazor.webassembly.js.gz" /> diff --git a/WebUI/WebUI.csproj b/WebUI/WebUI.csproj index c9f5a90..84b82c1 100644 --- a/WebUI/WebUI.csproj +++ b/WebUI/WebUI.csproj @@ -17,5 +17,9 @@ + + <_ContentIncludedByDefault Remove="wwwroot\sample-data\weather.json" /> + + \ No newline at end of file diff --git a/WebUI/wwwroot/sample-data/weather.json b/WebUI/wwwroot/sample-data/weather.json deleted file mode 100644 index 06463c0..0000000 --- a/WebUI/wwwroot/sample-data/weather.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "date": "2018-05-06", - "temperatureC": 1, - "summary": "Freezing" - }, - { - "date": "2018-05-07", - "temperatureC": 14, - "summary": "Bracing" - }, - { - "date": "2018-05-08", - "temperatureC": -13, - "summary": "Freezing" - }, - { - "date": "2018-05-09", - "temperatureC": -16, - "summary": "Balmy" - }, - { - "date": "2018-05-10", - "temperatureC": -2, - "summary": "Chilly" - } -] diff --git a/doc/Certifications.md b/doc/Certifications.md new file mode 100644 index 0000000..e4b0179 --- /dev/null +++ b/doc/Certifications.md @@ -0,0 +1,134 @@ +# Run on Arcade Machine + +Since the arcade is using some version XP, which does not support SHA256, the generated certification will not work. + +To solve this issue, you have to generate a certification using weaker signature algorithm. + +For certificate generation, I am using https://certificatetools.com/ + +## Generate Root CA + +First generate a root CA, by choosing the Root Certificate Authority. + +Under Subject Attributes, set Common Name to "Taito Arcade Machine CA", others are optional and can have any value. + +Under CSR options, choose MD5 as hash algorithm, choose Self-Sign type, then input year number. + +Submit and download "PKCS#12 Certificate and Key". + +## Generate Server Certificate + +Then generate server certificate, by choose Web Server as template. + +Under Subject Attributes, change Common Name to "GC local server" + +Under Subject Alternative Names, add DNS: cert.nesys.jp,data.nesys.jp,nesys.taito.co.jp,fjm170920zero.nesica.net + +Under CSR options, choose MD5 as hash algorithm, choose Sign With Certificate Authority 0 (the one just generated), then input year number. + +Submit and download "PKCS#12 Certificate and Key". + +## Import to server side + +In server side, import the certificates using mmc.exe. You can find a detailed guide at https://www.thesslstore.com/knowledgebase/ssl-install/how-to-import-intermediate-root-certificates-using-mmc/ + +Before import, first delete any old certificate Named "Taito Arcade Machine CA" or "GC local server" under Personal and "Trusted Root Certification Authorities" + +The root certificate goes to "Personal" and "Trusted Root Certification Authorities" + +The server certificate goes to "Personal" + +## Import to game side + +On the machine, first download and install http://outwardtruth.com/tools/win2k3tools/win2k3resourcetoolkit.htm + +After that, you will get WinHttpCertCfg.exe in "C:\Program Files\Windows Resource Kits\Tools". Use the following cmd to import root certificate + +``` +WinHttpCertCfg -i "E:\0_GC_LOCAL_SERVER\root.pfx" -C LOCAL_MACHINE\Root -a SYSTEM +``` + +After that, using IE to install the 2 certificates to MY(Personal) tab + +## Config the server + +In server, the config file is GC-local-server-rewrite.exe.config + +There, you will find an XML entry + +```xml + +``` + +Change value to the real server Ip + +Currently, there are two DB files, music.db3 and music4MAX.db3, which correspond to 4.52 and 4.61 data, change the following field according to your game version. + +```xml + +``` + + + +## Config host file + +In game side, change the host file, add the following entries + +``` +127.0.0.1 cert.nesys.jp +127.0.0.1 data.nesys.jp +127.0.0.1 nesys.taito.co.jp +127.0.0.1 fjm170920zero.nesica.net +``` + +You can now try to boot the game, it should be able to connect to the server. + +## Troubleshooting + +Import following to registry + +``` +Windows Registry Editor Version 5.00 + +[HKEY_LOCAL_MACHINE\SOFTWARE\TAITO] +"DisableLocalServer"=dword:00000001 + +[HKEY_LOCAL_MACHINE\SOFTWARE\TAITO\TYPEX] +"UpdateStep"=dword:00000000 +"LogLevel"=dword:00000003 +"TrafficCount"=dword:00000002 +"ConditionTime"=dword:0000012c +"EventNextTime"=dword:00000384 +"LogPath"="D:\\\\system\\\\CmdFile\\\\log" +"NewsPath"="D:\\\\system\\\\DUA\\\\news" +"EventPath"="D:\\\\system\\\\DUA\\\\event" +"Resolution"=dword:00000000 +"ScreenVertical"=dword:00000000 +"EventModeEnable"=dword:00000000 +"CoinCredit"=dword:00000001 +"UserSelectEnable"=dword:00000000 +"GameResult"=dword:00000000 +"IOErrorCoin"=dword:00000000 +"IOErrorCredit"=dword:00000000 +"GameKind"=dword:0004A2B9 +``` + +Then boot the game, log files should be under ``D:\system\CmdFile\log`` + +Open the one named `access*.log`, where * is the date. + +You can find the communication log, if you see any errors other than 404, report at https://github.com/asesidaa/GC-local-server-rewrite or contact me @asesidaa in discord. + +Some common errors: + +0x00002F8F: Certificate error, either the root certificate is not imported (so not trusted), or the certificate is not correct/not recognized by XP + +0x00002F9A: No private key, check if your certificate file is imported with private key. + +# DAT files + +Under game folder data/boot, there are all the dat files. + +If you have a new version, contact @Javaguru to use his template to parse these, and send me the parsed data. + +For music db, ask for a parsed json file for the new stage_param.dat. I can import these and make a new db file for the new version. \ No newline at end of file