Skip to content

Commit 636767a

Browse files
committed
add GT4 Spec II support
1 parent fef751b commit 636767a

6 files changed

Lines changed: 303 additions & 15 deletions

File tree

Core.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ internal class Core
2626
static GT4Database _gt4Database;
2727

2828
public static bool bIsOnline = false;
29+
public static bool bIsSpec2 = false;
2930

3031
static long USCheckAddr = 0x006BA380;
3132
static long OnlineCheckAddr = 0x721DD0;
@@ -288,7 +289,10 @@ static void HandleSaveLoad()
288289
break;
289290
case GT4SaveType.GT4_US:
290291
case GT4SaveType.GT4O_US:
291-
_gt4Database.CreateConnection("Resources/Databases/GT4_PREMIUM_US2560.sqlite");
292+
if (bIsSpec2)
293+
_gt4Database.CreateConnection("Resources/Databases/GT4_PREMIUM_US2560-Spec2.sqlite");
294+
else
295+
_gt4Database.CreateConnection("Resources/Databases/GT4_PREMIUM_US2560.sqlite");
292296
break;
293297
default:
294298
break;
@@ -445,7 +449,10 @@ public static void Run(IntPtr handle, string McPath, string TitleFormat, string
445449

446450
_gt4Database = new();
447451
_eventDb = new();
448-
_eventDb.Load("Resources/EventList.txt");
452+
if (bIsSpec2)
453+
_eventDb.Load("Resources/EventList-Spec2.txt");
454+
else
455+
_eventDb.Load("Resources/EventList.txt");
449456

450457
while (true)
451458
{

Form1.Designer.cs

Lines changed: 20 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Form1.cs

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,24 @@ public Form1()
4545
if (!string.IsNullOrEmpty(channelId))
4646
bGotChannelId = true;
4747
}
48-
if (ConfigurationManager.AppSettings.AllKeys.Contains("bIsOnline"))
48+
49+
if (ConfigurationManager.AppSettings.AllKeys.Contains("SelGame"))
4950
{
50-
string strIsOnline = ConfigurationManager.AppSettings["bIsOnline"];
51-
bool bIsOnline = bool.Parse(strIsOnline);
51+
string strSelGame = ConfigurationManager.AppSettings["SelGame"];
52+
int SelGame = int.Parse(strSelGame);
5253

53-
Core.bIsOnline = bIsOnline;
54-
rbGT4USOnline.Checked = bIsOnline;
55-
rbGT4US.Checked = !bIsOnline;
54+
switch (SelGame)
55+
{
56+
case 2:
57+
rbSpec2.Checked = true;
58+
break;
59+
case 1:
60+
rbGT4USOnline.Checked = true;
61+
break;
62+
default:
63+
rbGT4US.Checked = true;
64+
break;
65+
}
5666
}
5767

5868
UpdateLoginStatusLabel();
@@ -82,7 +92,15 @@ private void UpdateConfig()
8292
config.AppSettings.Settings["McPath"].Value = tbMcPath.Text;
8393
config.AppSettings.Settings["TitleFormat"].Value = tbTitleFormat.Text;
8494

85-
config.AppSettings.Settings["bIsOnline"].Value = rbGT4USOnline.Checked.ToString();
95+
if (rbSpec2.Checked)
96+
config.AppSettings.Settings["SelGame"].Value = "2";
97+
else if (rbGT4USOnline.Checked)
98+
config.AppSettings.Settings["SelGame"].Value = "1";
99+
else
100+
config.AppSettings.Settings["SelGame"].Value = "0";
101+
102+
//config.AppSettings.Settings["bIsOnline"].Value = rbGT4USOnline.Checked.ToString();
103+
//config.AppSettings.Settings["bIsSpec2"].Value = rbSpec2.Checked.ToString();
86104

87105
config.AppSettings.Settings["authToken"].Value = authToken;
88106
config.AppSettings.Settings["channelId"].Value = channelId;
@@ -238,5 +256,11 @@ private void btAPIKey_Click(object sender, EventArgs e)
238256
//else
239257
// ApiKey = "";
240258
}
259+
260+
private void rbSpec2_CheckedChanged(object sender, EventArgs e)
261+
{
262+
Core.bIsOnline = rbSpec2.Checked;
263+
Core.bIsSpec2 = rbSpec2.Checked;
264+
}
241265
}
242266
}
6.37 MB
Binary file not shown.

0 commit comments

Comments
 (0)