-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathConfig.cpp
1090 lines (942 loc) · 41.2 KB
/
Config.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Copyright (C) 2003-2009 Rice1964
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "stdafx.h"
#include "_BldNum.h"
#include "SimpleIni.h"
#include "Texture\TextureFilters\TextureFilters.h"
#define INI_FILE "RiceVideo.ini"
#define CONFIG_FILE "RiceVideo.cfg"
char *project_name = "RiceVideo";
// Disable the config dialog box to allow Vtune call graph feature to work
#define ENABLE_CONFIG_DIALOG
char *frameBufferSettings[] =
{
"None (default)",
"Hide Framebuffer Effects",
"Basic Framebuffer",
"Basic & Write Back",
"Write Back & Reload",
"Write Back Every Frame",
"With Emulator",
"Basic Framebuffer & With Emulator",
"With Emulator Read Only",
"With Emulator Write Only",
};
char *frameBufferWriteBackControlSettings[] =
{
"Every Frame (default)",
"Every 2 Frames",
"Every 3 Frames",
"Every 4 Frames",
"Every 5 Frames",
"Every 6 Frames",
"Every 7 Frames",
"Every 8 Frames",
};
char *renderToTextureSettings[] =
{
"None (default)",
"Hide Render-to-texture Effects",
"Basic Render-to-texture",
"Basic & Write Back",
"Write Back & Reload",
};
WindowSettingStruct windowSetting;
GlobalOptions options;
RomOptions defaultRomOptions;
RomOptions currentRomOptions;
FrameBufferOptions frameBufferOptions;
char szIniFileName[300];
char szIniSettingsFileName[300];
CSimpleIniA ini;
CSimpleIniA perRomIni;
//=======================================================
const SettingInfo ForceTextureFilterSettings[] =
{
"N64 Default Texture Filter", FORCE_DEFAULT_FILTER,
"Force Nearest Filter (faster, low quality)", FORCE_POINT_FILTER,
"Force Linear Filter (slower, better quality)", FORCE_LINEAR_FILTER,
};
const SettingInfo TextureEnhancementSettings[] =
{
"N64 original texture (No enhancement)", TEXTURE_NO_ENHANCEMENT,
"2xSaI", TEXTURE_2XSAI_ENHANCEMENT,
"HQ2x", TEXTURE_HQ2X_ENHANCEMENT,
"HQ2xS", TEXTURE_HQ2XS_ENHANCEMENT,
};
void WriteConfiguration(void);
void GenerateCurrentRomOptions();
HWND hPropSheetHwnd = NULL;
inline void ShowItem(HWND hDlg, UINT item, bool flag)
{
HWND itemwnd = GetDlgItem(hDlg, item);
ShowWindow(itemwnd,flag?SW_SHOW:SW_HIDE);
}
//////////////////////////////////////////////////////////////////////////
void GenerateFrameBufferOptions(void)
{
frameBufferOptions.bUpdateCIInfo = false;
frameBufferOptions.bCheckBackBufs = false;
frameBufferOptions.bWriteBackBufToRDRAM = false;
frameBufferOptions.bLoadBackBufFromRDRAM = false;
frameBufferOptions.bIgnore = true;
frameBufferOptions.bSupportRenderTextures = false;
frameBufferOptions.bCheckRenderTextures = false;
frameBufferOptions.bRenderTextureWriteBack = false;
frameBufferOptions.bLoadRDRAMIntoRenderTexture = false;
frameBufferOptions.bProcessCPUWrite = false;
frameBufferOptions.bProcessCPURead = false;
frameBufferOptions.bAtEachFrameUpdate = false;
frameBufferOptions.bIgnoreRenderTextureIfHeightUnknown = false;
switch( currentRomOptions.N64FrameBufferEmuType )
{
case FRM_BUF_NONE:
break;
case FRM_BUF_COMPLETE:
frameBufferOptions.bAtEachFrameUpdate = true;
frameBufferOptions.bProcessCPUWrite = true;
frameBufferOptions.bProcessCPURead = true;
frameBufferOptions.bUpdateCIInfo = true;
break;
case FRM_BUF_WRITEBACK_AND_RELOAD:
frameBufferOptions.bLoadBackBufFromRDRAM = true;
case FRM_BUF_BASIC_AND_WRITEBACK:
frameBufferOptions.bWriteBackBufToRDRAM = true;
case FRM_BUF_BASIC:
frameBufferOptions.bCheckBackBufs = true;
case FRM_BUF_IGNORE:
frameBufferOptions.bUpdateCIInfo = true;
break;
case FRM_BUF_BASIC_AND_WITH_EMULATOR:
// Banjo Kazooie
frameBufferOptions.bCheckBackBufs = true;
case FRM_BUF_WITH_EMULATOR:
frameBufferOptions.bUpdateCIInfo = true;
frameBufferOptions.bProcessCPUWrite = true;
frameBufferOptions.bProcessCPURead = true;
break;
case FRM_BUF_WITH_EMULATOR_READ_ONLY:
frameBufferOptions.bUpdateCIInfo = true;
frameBufferOptions.bProcessCPURead = true;
break;
case FRM_BUF_WITH_EMULATOR_WRITE_ONLY:
frameBufferOptions.bUpdateCIInfo = true;
frameBufferOptions.bProcessCPUWrite = true;
break;
}
///comebacktome
switch( currentRomOptions.N64RenderToTextureEmuType )
{
case TXT_BUF_NONE:
frameBufferOptions.bSupportRenderTextures = false;
break;
case TXT_BUF_WRITE_BACK_AND_RELOAD://checkme does nothing
frameBufferOptions.bLoadRDRAMIntoRenderTexture = true;
case TXT_BUF_WRITE_BACK:
frameBufferOptions.bRenderTextureWriteBack = true;
case TXT_BUF_NORMAL:
frameBufferOptions.bCheckRenderTextures = true;
frameBufferOptions.bIgnore = false;
case TXT_BUF_IGNORE:
frameBufferOptions.bUpdateCIInfo = true;
frameBufferOptions.bSupportRenderTextures = true;
break;
}
}
//////////////////////////////////////////////////////////////////////////
//========================================================================
extern void GetPluginDir( char * Directory );
void WriteConfiguration(void)
{
char name[1024];
GetPluginDir(name);
strcat(name, CONFIG_FILE);
FILE *f = fopen(name, "rb");
if (!f)
{
windowSetting.uWindowDisplayWidth=640;
windowSetting.uWindowDisplayHeight=480;
windowSetting.uFullScreenDisplayWidth=640;
windowSetting.uFullScreenDisplayHeight=480;
windowSetting.uScreenScaleMode = 0;
}
else
fclose(f);
//Lets set window settings
ini.SetLongValue("WindowSetting", "WindowedWidth", windowSetting.uWindowDisplayWidth);
ini.SetLongValue("WindowSetting", "WindowedHeight", windowSetting.uWindowDisplayHeight);
ini.SetLongValue("WindowSetting", "FullscreenWidth", windowSetting.uFullScreenDisplayWidth);
ini.SetLongValue("WindowSetting", "FullscreenHeight", windowSetting.uFullScreenDisplayHeight);
ini.SetLongValue("WindowSetting", "ScreenScaleMode", (uint32)windowSetting.uScreenScaleMode);
//Now rendering modes
ini.SetLongValue("RenderSetting", "DirectXAntiAliasingValue", (uint32)options.DirectXAntiAliasingValue);
ini.SetLongValue("RenderSetting", "DirectXAnisotropyValue", (uint32)options.DirectXAnisotropyValue);
ini.SetLongValue("RenderSetting", "EnableFog", options.bEnableFog);
ini.SetLongValue("RenderSetting", "WinFrameMode", options.bWinFrameMode);
ini.SetLongValue("RenderSetting", "MipMaps", options.bMipMaps);
//Now texture settings
ini.SetLongValue("Texture Settings", "CacheHiResTextures" , (uint32)options.bCacheHiResTextures);
ini.SetLongValue("Texture Settings", "ForceTextureFilter", (uint32)options.forceTextureFilter);
ini.SetLongValue("Texture Settings", "LoadHiResTextures", (uint32)options.bLoadHiResTextures);
ini.SetLongValue("Texture Settings", "DumpTexturesToFiles", (uint32)options.bDumpTexturesToFiles);
ini.SetLongValue("Texture Settings", "TextureEnhancement", (uint32)options.textureEnhancement);
ini.SetLongValue("Texture Settings", "TextureEnhancementControl", (uint32)options.textureEnhancementControl);
//Now framebuffer Settings
ini.SetLongValue("FrameBufferSettings", "FrameBufferType", defaultRomOptions.N64FrameBufferEmuType);
ini.SetLongValue("FrameBufferSettings", "FrameBufferWriteBackControl", defaultRomOptions.N64FrameBufferWriteBackControl);
ini.SetLongValue("FrameBufferSettings", "RenderToTexture", defaultRomOptions.N64RenderToTextureEmuType);
//Now just some misc settings
ini.SetLongValue("MiscSettings", "EnableHacks", options.bEnableHacks);
//Ok lets save the settings
ini.SaveFile(name);
ini.Reset();
}
void ReadConfiguration(void)
{
char name[1024];
GetPluginDir(name);
strcat(name, CONFIG_FILE);
options.bEnableHacks = TRUE;
defaultRomOptions.N64FrameBufferEmuType = FRM_BUF_NONE;
defaultRomOptions.N64FrameBufferWriteBackControl = FRM_BUF_WRITEBACK_NORMAL;
defaultRomOptions.N64RenderToTextureEmuType = TXT_BUF_NONE;
FILE *f = fopen(name, "rb");
if(!f)
{
options.bEnableFog = TRUE;
options.bWinFrameMode = FALSE;
options.bMipMaps = TRUE;
options.forceTextureFilter = 0;
options.bLoadHiResTextures = FALSE;
// set caching by default to "off"
options.bCacheHiResTextures = FALSE;
options.bDumpTexturesToFiles = FALSE;
options.textureEnhancement = 0;
options.textureEnhancementControl = 0;
options.DirectXAntiAliasingValue = 0;
options.DirectXAnisotropyValue = 0;
defaultRomOptions.N64FrameBufferEmuType = FRM_BUF_NONE;
defaultRomOptions.N64FrameBufferWriteBackControl = FRM_BUF_WRITEBACK_NORMAL;
defaultRomOptions.N64RenderToTextureEmuType = TXT_BUF_NONE;
windowSetting.uScreenScaleMode = 0;
WriteConfiguration();
return;
}
else
{
fclose(f);
ini.LoadFile(name);
windowSetting.uWindowDisplayWidth = (uint16)ini.GetLongValue("WindowSetting", "WindowedWidth", 640);
windowSetting.uWindowDisplayHeight = (uint16)ini.GetLongValue("WindowSetting", "WindowedHeight", 480);
windowSetting.uDisplayWidth = windowSetting.uWindowDisplayWidth;
windowSetting.uDisplayHeight = windowSetting.uWindowDisplayHeight;
windowSetting.uFullScreenDisplayWidth = (uint16)ini.GetLongValue("WindowSetting", "FullscreenWidth", 640);
windowSetting.uFullScreenDisplayHeight = (uint16)ini.GetLongValue("WindowSetting", "FullScreenHeight", 480);
windowSetting.uScreenScaleMode = ini.GetLongValue("WindowSetting", "ScreenScaleMode", 0);
defaultRomOptions.N64FrameBufferEmuType = ini.GetLongValue("FrameBufferSettings", "FrameBufferSetting");
defaultRomOptions.N64FrameBufferWriteBackControl = ini.GetLongValue("FrameBufferSettings", "FrameBufferWriteBackControl");
defaultRomOptions.N64RenderToTextureEmuType = ini.GetLongValue("FrameBufferSettings", "RenderToTexture");
options.textureEnhancement = ini.GetLongValue("Texture Settings","TextureEnhancement");
options.textureEnhancementControl = ini.GetLongValue("Texture Settings","TextureEnhancementControl");
options.forceTextureFilter = ini.GetLongValue("Texture Settings","ForceTextureFilter");
options.bLoadHiResTextures = ini.GetBoolValue("Texture Settings","LoadHiResTextures");
options.bCacheHiResTextures = ini.GetBoolValue("Texture Settings","CacheHiResTextures");
options.bDumpTexturesToFiles = ini.GetBoolValue("Texture Settings","DumpTexturesToFiles");
options.DirectXAntiAliasingValue = ini.GetLongValue("RenderSetting", "DirectXAntiAliasingValue");
options.DirectXAnisotropyValue = ini.GetLongValue("RenderSetting", "DirectXAnisotropyValue");
options.bEnableFog = ini.GetBoolValue("RenderSetting", "EnableFog");
options.bWinFrameMode = ini.GetBoolValue("RenderSetting", "WinFrameMode");
options.bMipMaps = ini.GetBoolValue("RenderSetting", "MipMaps");
ini.Reset();
}
}
//---------------------------------------------------------------------------------------
BOOL InitConfiguration(void)
{
//Initialize this DLL
GetPluginDir(szIniFileName);
strcat(szIniFileName, INI_FILE);
//Load the per rom configs into memory
perRomIni.LoadFile(szIniFileName);
ReadConfiguration();
return TRUE;
}
void GenerateCurrentRomOptions()
{
currentRomOptions.N64FrameBufferEmuType =g_curRomInfo.dwFrameBufferOption;
currentRomOptions.N64FrameBufferWriteBackControl =defaultRomOptions.N64FrameBufferWriteBackControl;
currentRomOptions.N64RenderToTextureEmuType =g_curRomInfo.dwRenderToTextureOption;
options.enableHackForGames = NO_HACK_FOR_GAME;
//URGHK Wish there was some way to clean all of this up
if ((strncmp(g_curRomInfo.szGameName, "BANJO TOOIE", 11) == 0))
{
options.enableHackForGames = HACK_FOR_BANJO_TOOIE;
}
else if ((strncmp(g_curRomInfo.szGameName, "DR.MARIO", 8) == 0))
{
options.enableHackForGames = HACK_FOR_DR_MARIO;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "Pilot", 5) == 0))
{
options.enableHackForGames = HACK_FOR_PILOT_WINGS;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "YOSHI", 5) == 0))
{
options.enableHackForGames = HACK_FOR_YOSHI;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "NITRO", 5) == 0))
{
options.enableHackForGames = HACK_FOR_NITRO;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "TONY HAWK", 9) == 0))
{
options.enableHackForGames = HACK_FOR_TONYHAWK;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "THPS", 4) == 0))
{
options.enableHackForGames = HACK_FOR_TONYHAWK;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "SPIDERMAN", 9) == 0))
{
options.enableHackForGames = HACK_FOR_TONYHAWK;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "NASCAR", 6) == 0))
{
options.enableHackForGames = HACK_FOR_NASCAR;
}
else if ((strstr(g_curRomInfo.szGameName, "ZELDA") != 0) && (strstr(g_curRomInfo.szGameName, "MASK") != 0))
{
options.enableHackForGames = HACK_FOR_ZELDA_MM;
}
else if ((strstr(g_curRomInfo.szGameName, "ZELDA") != 0))
{
options.enableHackForGames = HACK_FOR_ZELDA;
}
else if ((strstr(g_curRomInfo.szGameName, "Ogre") != 0))
{
options.enableHackForGames = HACK_FOR_OGRE_BATTLE;
}
else if ((strstr(g_curRomInfo.szGameName, "TWINE") != 0))
{
options.enableHackForGames = HACK_FOR_TWINE;
}
else if ((strstr(g_curRomInfo.szGameName, "Baseball") != 0) && (strstr(g_curRomInfo.szGameName, "Star") != 0))
{
options.enableHackForGames = HACK_FOR_ALL_STAR_BASEBALL;
}
else if ((strstr(g_curRomInfo.szGameName, "Tigger") != 0) && (strstr(g_curRomInfo.szGameName, "Honey") != 0))
{
options.enableHackForGames = HACK_FOR_TIGER_HONEY_HUNT;
}
else if ((strstr(g_curRomInfo.szGameName, "Bust") != 0) && (strstr(g_curRomInfo.szGameName, "Move") != 0))
{
options.enableHackForGames = HACK_FOR_BUST_A_MOVE;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "MarioTennis",11) == 0))
{
options.enableHackForGames = HACK_FOR_MARIO_TENNIS;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "SUPER BOWLING",13) == 0))
{
options.enableHackForGames = HACK_FOR_SUPER_BOWLING;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "CONKER",6) == 0))
{
options.enableHackForGames = HACK_FOR_CONKER;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "MK_MYTHOLOGIES",14) == 0))
{
options.enableHackForGames = HACK_REVERSE_Y_COOR;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "Fighting Force",14) == 0))
{
options.enableHackForGames = HACK_REVERSE_XY_COOR;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "GOLDENEYE",9) == 0))
{
options.enableHackForGames = HACK_FOR_GOLDEN_EYE;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "F-ZERO",6) == 0))
{
options.enableHackForGames = HACK_FOR_FZERO;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "Command&Conquer",15) == 0))
{
options.enableHackForGames = HACK_FOR_COMMANDCONQUER;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "READY 2 RUMBLE",14) == 0))
{
options.enableHackForGames = HACK_FOR_RUMBLE;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "READY to RUMBLE",15) == 0))
{
options.enableHackForGames = HACK_FOR_RUMBLE;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "South Park Rally",16) == 0))
{
options.enableHackForGames = HACK_FOR_SOUTH_PARK_RALLY;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "Extreme G 2",11) == 0))
{
options.enableHackForGames = HACK_FOR_EXTREME_G2;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "MarioGolf64",11) == 0))
{
options.enableHackForGames = HACK_FOR_MARIO_GOLF;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "MLB FEATURING",13) == 0))
{
options.enableHackForGames = HACK_FOR_MLB;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "POLARISSNOCROSS",15) == 0))
{
options.enableHackForGames = HACK_FOR_POLARISSNOCROSS;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "TOP GEAR RALLY",14) == 0))
{
options.enableHackForGames = HACK_FOR_TOPGEARRALLY;
}
else if ((strnicmp(g_curRomInfo.szGameName, "TOP GEAR OVERDRIVE", 18) == 0))
{
options.enableHackForGames = HACK_FOR_TOPGEAROVERDRIVE;
}
else if ((_strnicmp(g_curRomInfo.szGameName, "DUKE NUKEM",10) == 0))
{
options.enableHackForGames = HACK_FOR_DUKE_NUKEM;
}
else if ((_stricmp(g_curRomInfo.szGameName, "MARIOKART64") == 0))
{
options.enableHackForGames = HACK_FOR_MARIO_KART;
}
else if ((_stricmp(g_curRomInfo.szGameName, "Diddy Kong Racing") == 0))
{
options.enableHackForGames = HACK_FOR_DIDDY_KONG_RACING;
}
if( currentRomOptions.N64FrameBufferEmuType == 0 ) currentRomOptions.N64FrameBufferEmuType = defaultRomOptions.N64FrameBufferEmuType;
else currentRomOptions.N64FrameBufferEmuType--;
if( currentRomOptions.N64RenderToTextureEmuType == 0 ) currentRomOptions.N64RenderToTextureEmuType = defaultRomOptions.N64RenderToTextureEmuType;
else currentRomOptions.N64RenderToTextureEmuType--;
GenerateFrameBufferOptions();
if( options.enableHackForGames == HACK_FOR_MARIO_GOLF || options.enableHackForGames == HACK_FOR_MARIO_TENNIS )
{
frameBufferOptions.bIgnoreRenderTextureIfHeightUnknown = true;
}
}
void Ini_GetRomOptions(LPGAMESETTING pGameSetting)
{
CHAR szCRC[50+1];
// Generate the CRC-ID for this rom:
wsprintf(szCRC, "%08x%08x-%02x", pGameSetting->romheader.dwCRC1, pGameSetting->romheader.dwCRC2, pGameSetting->romheader.nCountryID);
pGameSetting->bDisableCulling = perRomIni.GetBoolValue(szCRC, "bDisableCulling", false);
pGameSetting->bIncTexRectEdge = perRomIni.GetBoolValue(szCRC, "bIncTexRectEdge", false);
pGameSetting->bZHack = perRomIni.GetBoolValue(szCRC, "bZHack", false);
pGameSetting->bPrimaryDepthHack = perRomIni.GetBoolValue(szCRC, "bPrimaryDepthHack", false);
pGameSetting->bTexture1Hack = perRomIni.GetBoolValue(szCRC, "bTexture1Hack", false);
pGameSetting->VIWidth = perRomIni.GetLongValue(szCRC, "VIWidth", -1);
pGameSetting->VIHeight = perRomIni.GetLongValue(szCRC, "VIHeight", -1);
pGameSetting->UseCIWidthAndRatio = perRomIni.GetLongValue(szCRC, "UseCIWidthAndRatio", NOT_USE_CI_WIDTH_AND_RATIO);
pGameSetting->bTxtSizeMethod2 = perRomIni.GetBoolValue(szCRC, "bTxtSizeMethod2", false);
pGameSetting->bEnableTxtLOD = perRomIni.GetBoolValue(szCRC, "bEnableTxtLOD", false);
pGameSetting->dwFrameBufferOption = perRomIni.GetLongValue(szCRC, "dwFrameBufferOption", 0);
pGameSetting->dwRenderToTextureOption = perRomIni.GetLongValue(szCRC, "dwRenderToTextureOption", 0);
}
void Ini_StoreRomOptions(LPGAMESETTING pGameSetting)
{
CHAR szCRC[50+1];
// Generate the CRC-ID for this rom:
wsprintf(szCRC, "%08x%08x-%02x", pGameSetting->romheader.dwCRC1, pGameSetting->romheader.dwCRC2, pGameSetting->romheader.nCountryID);
perRomIni.SetLongValue(szCRC, "bDisableCulling", pGameSetting->bDisableCulling);
perRomIni.SetLongValue(szCRC, "dwFrameBufferOption", pGameSetting->dwFrameBufferOption);
perRomIni.SetLongValue(szCRC, "dwRenderToTextureOption", pGameSetting->dwRenderToTextureOption);
perRomIni.SetLongValue(szCRC, "bIncTexRectEdge", pGameSetting->bIncTexRectEdge);
perRomIni.SetLongValue(szCRC, "bZHack", pGameSetting->bZHack);
perRomIni.SetLongValue(szCRC, "bPrimaryDepthHack", pGameSetting->bPrimaryDepthHack);
perRomIni.SetLongValue(szCRC, "bTexture1Hack", pGameSetting->bTexture1Hack);
perRomIni.SetLongValue(szCRC, "VIWidth", pGameSetting->VIWidth);
perRomIni.SetLongValue(szCRC, "VIHeight", pGameSetting->VIHeight);
perRomIni.SetLongValue(szCRC, "UseCIWidthAndRatio", pGameSetting->UseCIWidthAndRatio);
perRomIni.SetLongValue(szCRC, "bTxtSizeMethod2", pGameSetting->bTxtSizeMethod2);
perRomIni.SetLongValue(szCRC, "bEnableTxtLOD", pGameSetting->bEnableTxtLOD);
perRomIni.SaveFile(szIniFileName);
//Ensure that we now have the up to date settings stored in memory by flushing out the current ones and reloading the file
perRomIni.Reset();
perRomIni.LoadFile(szIniFileName);
TRACE0("Rom option is changed and saved");
}
///////////////////////////////////////
//// Constructors / Deconstructors
///////////////////////////////////////////////
// Find the entry corresponding to the specified rom.
// If the rom is not found, a new entry is created
// The resulting value is returned
void __cdecl DebuggerAppendMsg (const char * Message, ...);
GameSetting g_curRomInfo;
void ROM_GetRomNameFromHeader(TCHAR * szName, ROMHeader * pHdr)
{
TCHAR * p;
memcpy(szName, pHdr->szName, 20);
szName[20] = '\0';
p = szName + (lstrlen(szName) -1); // -1 to skip null
while (p >= szName && *p == ' ')
{
*p = 0;
p--;
}
}
uint32 CountryCodeToTVSystem(uint32 countryCode)
{
uint32 system;
switch(countryCode)
{
case 0:
case '7':
case 0x41:
case 0x45:
case 0x4A:
system = TV_SYSTEM_NTSC;
break;
case 0x44:
case 0x46:
case 'I':
case 0x50:
case 'S':
case 0x55:
case 0x58:
case 0x59:
case 0x20:
case 0x21:
case 0x38:
case 0x70:
system = TV_SYSTEM_PAL;
break;
/* ??? */
default:
system = TV_SYSTEM_PAL;
break;
}
return system;
}
LRESULT APIENTRY OptionsDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int i;
switch(message)
{
case WM_INITDIALOG:
//General config op
SendDlgItemMessage(hDlg, IDC_FOG, BM_SETCHECK, options.bEnableFog ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_WINFRAME_MODE, BM_SETCHECK, options.bWinFrameMode ? BST_CHECKED : BST_UNCHECKED, 0);
//--------------------------------------------------------------
// Begin Resolution handling code
//--------------------------------------------------------------
SendDlgItemMessage(hDlg, IDC_RESOLUTION_FULL_SCREEN_MODE, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hDlg, IDC_RESOLUTION_WINDOW_MODE, CB_RESETCONTENT, 0, 0);
for(int maxres=0; maxres<CGraphicsContext::m_numOfResolutions; maxres++ ) // Really need to rethink this -CLEAN ME -FIX ME
{
sprintf(generalText, "%d x %d", CGraphicsContext::m_FullScreenResolutions[maxres][0], CGraphicsContext::m_FullScreenResolutions[maxres][1]);
SendDlgItemMessage(hDlg, IDC_RESOLUTION_FULL_SCREEN_MODE, CB_INSERTSTRING, maxres, (LPARAM) generalText);
SendDlgItemMessage(hDlg, IDC_RESOLUTION_WINDOW_MODE, CB_INSERTSTRING, maxres, (LPARAM) generalText);
if( windowSetting.uFullScreenDisplayWidth == CGraphicsContext::m_FullScreenResolutions[maxres][0] &&
windowSetting.uFullScreenDisplayHeight == CGraphicsContext::m_FullScreenResolutions[maxres][1] )
{
SendDlgItemMessage(hDlg, IDC_RESOLUTION_FULL_SCREEN_MODE, CB_SETCURSEL, maxres, 0);
}
if ( windowSetting.uWindowDisplayWidth == CGraphicsContext::m_FullScreenResolutions[maxres][0] &&
windowSetting.uWindowDisplayHeight == CGraphicsContext::m_FullScreenResolutions[maxres][1])
{
SendDlgItemMessage(hDlg, IDC_RESOLUTION_WINDOW_MODE, CB_SETCURSEL, maxres, 0);
}
}
SendDlgItemMessage(hDlg, IDC_SCALE_MODE, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hDlg, IDC_SCALE_MODE, CB_INSERTSTRING, 0, (LPARAM) "Stretch (Default)");
SendDlgItemMessage(hDlg, IDC_SCALE_MODE, CB_INSERTSTRING, 1, (LPARAM) "Pillarbox");
SendDlgItemMessage(hDlg, IDC_SCALE_MODE, CB_INSERTSTRING, 2, (LPARAM) "Extend");
SendDlgItemMessage(hDlg, IDC_SCALE_MODE, CB_SETCURSEL, windowSetting.uScreenScaleMode, 0);
//--------------------------------------------------------------
// End resolution handling code
//--------------------------------------------------------------
//--------------------------------------------------------------
// Begin framebuffer options
//--------------------------------------------------------------
SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_RESETCONTENT, 0, 0);
for (i = 0; i<sizeof(frameBufferSettings) / sizeof(char*); i++)
{
SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_INSERTSTRING, i, (LPARAM)frameBufferSettings[i]);
}
SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_SETCURSEL, defaultRomOptions.N64FrameBufferEmuType, 0);
SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_WRITE_BACK_CONTROL, CB_RESETCONTENT, 0, 0);
for (i = 0; i<sizeof(frameBufferWriteBackControlSettings) / sizeof(char*); i++)
{
SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_WRITE_BACK_CONTROL, CB_INSERTSTRING, i, (LPARAM)frameBufferWriteBackControlSettings[i]);
}
SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_WRITE_BACK_CONTROL, CB_SETCURSEL, defaultRomOptions.N64FrameBufferWriteBackControl, 0);
SendDlgItemMessage(hDlg, IDC_RENDER_TO_TEXTURE_SETTING, CB_RESETCONTENT, 0, 0);
for (i = 0; i<sizeof(renderToTextureSettings) / sizeof(char*); i++)
{
SendDlgItemMessage(hDlg, IDC_RENDER_TO_TEXTURE_SETTING, CB_INSERTSTRING, i, (LPARAM)renderToTextureSettings[i]);
}
SendDlgItemMessage(hDlg, IDC_RENDER_TO_TEXTURE_SETTING, CB_SETCURSEL, defaultRomOptions.N64RenderToTextureEmuType, 0);
//--------------------------------------------------------------
// End framebuffer options
//--------------------------------------------------------------
//--------------------------------------------------------------
// Begin texture enhancement code
//--------------------------------------------------------------
SendDlgItemMessage(hDlg, IDC_TEXTURE_ENHANCEMENT, CB_RESETCONTENT, 0, 0);
for (i = 0; i<sizeof(TextureEnhancementSettings) / sizeof(SettingInfo); i++)
{
SendDlgItemMessage(hDlg, IDC_TEXTURE_ENHANCEMENT, CB_INSERTSTRING, i, (LPARAM)TextureEnhancementSettings[i].description);
}
SendDlgItemMessage(hDlg, IDC_FORCE_TEXTURE_FILTER, CB_RESETCONTENT, 0, 0);
for (i = 0; i<sizeof(ForceTextureFilterSettings) / sizeof(SettingInfo); i++)
{
SendDlgItemMessage(hDlg, IDC_FORCE_TEXTURE_FILTER, CB_INSERTSTRING, i, (LPARAM)ForceTextureFilterSettings[i].description);
}
SendDlgItemMessage(hDlg, IDC_TEXTURE_ENHANCEMENT, CB_SETCURSEL, options.textureEnhancement, 0);
SendDlgItemMessage(hDlg, IDC_FORCE_TEXTURE_FILTER, CB_SETCURSEL, options.forceTextureFilter, 0);
SendDlgItemMessage(hDlg, IDC_MIPMAPS, BM_SETCHECK, options.bMipMaps ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_LOAD_HIRES_TEXTURE, BM_SETCHECK, options.bLoadHiResTextures ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_CACHE_HIRES_TEXTURE, BM_SETCHECK, options.bCacheHiResTextures ? BST_CHECKED : BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_DUMP_TEXTURE_TO_FILES, BM_SETCHECK, options.bDumpTexturesToFiles ? BST_CHECKED : BST_UNCHECKED, 0);
//--------------------------------------------------------------
// End texture enhancement code
//--------------------------------------------------------------
//--------------------------------------------------------------
// Start of Direct X related settings
//--------------------------------------------------------------
SendDlgItemMessage(hDlg, IDC_SLIDER_FSAA, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, 8));
SendDlgItemMessage(hDlg, IDC_SLIDER_FSAA, TBM_SETPAGESIZE, 0, (LPARAM) 4);
SendDlgItemMessage(hDlg, IDC_SLIDER_ANISO, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, 16));
SendDlgItemMessage(hDlg, IDC_SLIDER_ANISO, TBM_SETPAGESIZE, 0, (LPARAM)4);
sprintf(generalText, "Full Screen Anti-Aliasing: %d X", options.DirectXAntiAliasingValue);
SetWindowText(GetDlgItem(hDlg, IDC_ANTI_ALIASING_TEXT), generalText);
sprintf(generalText, "Anisotropic Filtering: %d X", options.DirectXAnisotropyValue);
SetWindowText(GetDlgItem(hDlg, IDC_ANISOTROPIC_TEXT), generalText);
SendDlgItemMessage(hDlg, IDC_SLIDER_FSAA, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)options.DirectXAntiAliasingValue);
SendDlgItemMessage(hDlg, IDC_SLIDER_ANISO, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)options.DirectXAnisotropyValue);
//--------------------------------------------------------------
// End of Direct X related settings
//--------------------------------------------------------------
if( status.bGameIsRunning )
{
EnableWindow(GetDlgItem(hDlg, IDC_RESOLUTION_WINDOW_MODE), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER_FSAA), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER_ANISO), FALSE);
}
return(TRUE);
case WM_HSCROLL:
switch (LOWORD(wParam))
{
case TB_ENDTRACK:
case TB_THUMBTRACK:
case TB_PAGEDOWN:
case TB_PAGEUP:
if ((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER_FSAA))
{
sprintf(generalText, "Full Screen Anti-Aliasing: %llu X", SendMessage(GetDlgItem(hDlg, IDC_SLIDER_FSAA), TBM_GETPOS, 0, 0));
SetWindowText(GetDlgItem(hDlg, IDC_ANTI_ALIASING_TEXT), generalText);
}
else if ((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER_ANISO))
{
sprintf(generalText, "Anisotropic Filtering: %llu X", SendMessage(GetDlgItem(hDlg, IDC_SLIDER_ANISO), TBM_GETPOS, 0, 0));
SetWindowText(GetDlgItem(hDlg, IDC_ANISOTROPIC_TEXT), generalText);
}
break;
}
break;
//Propertysheet handling
case WM_NOTIFY:
{
LPNMHDR lpnm = (LPNMHDR) lParam;
switch (lpnm->code)
{
case PSN_APPLY:
SendMessage(hDlg, WM_COMMAND, IDOK, lParam);
EndDialog(lpnm->hwndFrom, TRUE);
break;
case PSN_RESET :
//Handle a Cancel button click, if necessary
EndDialog(lpnm->hwndFrom, TRUE);
break;
default:
return 0;
}
}
return(TRUE);
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
{
options.bEnableFog = (SendDlgItemMessage(hDlg, IDC_FOG, BM_GETCHECK, 0, 0) == BST_CHECKED);
options.bWinFrameMode = (SendDlgItemMessage(hDlg, IDC_WINFRAME_MODE, BM_GETCHECK, 0, 0) == BST_CHECKED);
//Begin Resolutioon Handling
windowSetting.uScreenScaleMode = (int) SendDlgItemMessage(hDlg, IDC_SCALE_MODE, CB_GETCURSEL, 0, 0);
i = (int) SendDlgItemMessage(hDlg, IDC_RESOLUTION_WINDOW_MODE, CB_GETCURSEL, 0, 0);
windowSetting.uWindowDisplayWidth = CGraphicsContext::m_FullScreenResolutions[i][0];
windowSetting.uWindowDisplayHeight = CGraphicsContext::m_FullScreenResolutions[i][1];
i = (int) SendDlgItemMessage(hDlg, IDC_RESOLUTION_FULL_SCREEN_MODE, CB_GETCURSEL, 0, 0);
windowSetting.uFullScreenDisplayWidth = CGraphicsContext::m_FullScreenResolutions[i][0];
windowSetting.uFullScreenDisplayHeight = CGraphicsContext::m_FullScreenResolutions[i][1];
windowSetting.uDisplayWidth = windowSetting.uWindowDisplayWidth;
windowSetting.uDisplayHeight = windowSetting.uWindowDisplayHeight;
//End Resolution Handling
options.DirectXAntiAliasingValue = (uint32_t) SendDlgItemMessage(hDlg, IDC_SLIDER_FSAA, TBM_GETPOS, 0, 0);
if (options.DirectXAntiAliasingValue == 1)
options.DirectXAntiAliasingValue = 0;
options.DirectXAnisotropyValue = (uint32_t) SendDlgItemMessage(hDlg, IDC_SLIDER_ANISO, TBM_GETPOS, 0, 0);
//--------------------------------------------------------------
// Begin texture enhancement code
//--------------------------------------------------------------
//We need to make sure the option has actually changed otherwise it recalls same methods when no setting has been changed.
bool bTempLoadHiRes = options.bLoadHiResTextures;
bool bTempCacheTex = options.bCacheHiResTextures;
options.textureEnhancement = TextureEnhancementSettings[SendDlgItemMessage(hDlg, IDC_TEXTURE_ENHANCEMENT, CB_GETCURSEL, 0, 0)].setting;
options.forceTextureFilter = ForceTextureFilterSettings[SendDlgItemMessage(hDlg, IDC_FORCE_TEXTURE_FILTER, CB_GETCURSEL, 0, 0)].setting;
options.bMipMaps = (SendDlgItemMessage(hDlg, IDC_MIPMAPS, BM_GETCHECK, 0, 0) == BST_CHECKED);
options.bLoadHiResTextures = (SendDlgItemMessage(hDlg, IDC_LOAD_HIRES_TEXTURE, BM_GETCHECK, 0, 0) == BST_CHECKED);
options.bDumpTexturesToFiles = (SendDlgItemMessage(hDlg, IDC_DUMP_TEXTURE_TO_FILES, BM_GETCHECK, 0, 0) == BST_CHECKED);
options.bCacheHiResTextures = (SendDlgItemMessage(hDlg, IDC_CACHE_HIRES_TEXTURE, BM_GETCHECK, 0, 0) == BST_CHECKED);
if (status.bGameIsRunning) //BACKTOME, NEEDS RETHINKING -- CLEAN ME
{
if (bTempLoadHiRes != options.bLoadHiResTextures)
{
if (options.bLoadHiResTextures)
{
InitHiresTextures();
gTextureManager.RecheckHiresForAllTextures();
}
else
CloseHiresTextures();
}
if (bTempCacheTex != options.bCacheHiResTextures)
{
if (options.bCacheHiResTextures)
InitHiresCache();
else
ClearHiresCache();
}
if (options.bDumpTexturesToFiles)
CreateDumpFolders();
}
//--------------------------------------------------------------
// End texture enhancement code
//--------------------------------------------------------------
defaultRomOptions.N64FrameBufferEmuType = (uint32_t) SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_GETCURSEL, 0, 0);
defaultRomOptions.N64FrameBufferWriteBackControl = (uint32_t) SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_WRITE_BACK_CONTROL, CB_GETCURSEL, 0, 0);
defaultRomOptions.N64RenderToTextureEmuType = (uint32_t) SendDlgItemMessage(hDlg, IDC_RENDER_TO_TEXTURE_SETTING, CB_GETCURSEL, 0, 0);
WriteConfiguration();
EndDialog(hDlg, TRUE);
}
return(TRUE);
case IDCANCEL:
EndDialog(hDlg, TRUE);
return(TRUE);
case IDC_ABOUT:
DllAbout(hDlg);
break;
}
}
return FALSE;
}
//We need to keep these rom setting page, they should ALWAYS overide any other option --clean me --fix me
LRESULT APIENTRY RomSettingProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
// Normal bi-state variable
SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_INSERTSTRING, 0, (LPARAM) "Default");
for(int i=0; i<sizeof(frameBufferSettings)/sizeof(char*); i++ )
{
SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_INSERTSTRING, i+1, (LPARAM) frameBufferSettings[i]);
}
SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_SETCURSEL, g_curRomInfo.dwFrameBufferOption, 0);
SendDlgItemMessage(hDlg, IDC_RENDER_TO_TEXTURE_SETTING, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hDlg, IDC_RENDER_TO_TEXTURE_SETTING, CB_INSERTSTRING, 0, (LPARAM) "Default");
for(int i=0; i<sizeof(renderToTextureSettings)/sizeof(char*); i++ )
{
SendDlgItemMessage(hDlg, IDC_RENDER_TO_TEXTURE_SETTING, CB_INSERTSTRING, i+1, (LPARAM) renderToTextureSettings[i]);
}
SendDlgItemMessage(hDlg, IDC_RENDER_TO_TEXTURE_SETTING, CB_SETCURSEL, g_curRomInfo.dwRenderToTextureOption, 0);
SendDlgItemMessage(hDlg, IDC_USE_CI_WIDTH_AND_RATIO, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hDlg, IDC_USE_CI_WIDTH_AND_RATIO, CB_INSERTSTRING, 0, (LPARAM) "No");
SendDlgItemMessage(hDlg, IDC_USE_CI_WIDTH_AND_RATIO, CB_INSERTSTRING, 1, (LPARAM) "NTSC");
SendDlgItemMessage(hDlg, IDC_USE_CI_WIDTH_AND_RATIO, CB_INSERTSTRING, 2, (LPARAM) "PAL");
SendDlgItemMessage(hDlg, IDC_USE_CI_WIDTH_AND_RATIO, CB_SETCURSEL, g_curRomInfo.UseCIWidthAndRatio, 0);
// Less useful options
SendDlgItemMessage(hDlg, IDC_INCREASE_TEXTRECT_EDGE, BM_SETCHECK, g_curRomInfo.bIncTexRectEdge?BST_CHECKED:BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_Z_HACK, BM_SETCHECK, g_curRomInfo.bZHack?BST_CHECKED:BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_PRIMARY_DEPTH_HACK, BM_SETCHECK, g_curRomInfo.bPrimaryDepthHack?BST_CHECKED:BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_TEXTURE_1_HACK, BM_SETCHECK, g_curRomInfo.bTexture1Hack?BST_CHECKED:BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_DISABLE_CULLING, BM_SETCHECK, g_curRomInfo.bDisableCulling?BST_CHECKED:BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_TXT_SIZE_METHOD_2, BM_SETCHECK, g_curRomInfo.bTxtSizeMethod2?BST_CHECKED:BST_UNCHECKED, 0);
SendDlgItemMessage(hDlg, IDC_ENABLE_LOD, BM_SETCHECK, g_curRomInfo.bEnableTxtLOD?BST_CHECKED:BST_UNCHECKED, 0);
if( g_curRomInfo.VIWidth > 0 )
{
sprintf(generalText,"%d",g_curRomInfo.VIWidth);
SetDlgItemText(hDlg,IDC_EDIT_WIDTH,generalText);
}
if( g_curRomInfo.VIHeight > 0 )
{
sprintf(generalText,"%d",g_curRomInfo.VIHeight);
SetDlgItemText(hDlg,IDC_EDIT_HEIGHT,generalText);
}
return(TRUE);
//Propertysheet handling
case WM_NOTIFY:
{
LPNMHDR lpnm = (LPNMHDR) lParam;
switch (lpnm->code)
{
case PSN_APPLY:
SendMessage(hDlg, WM_COMMAND, IDOK, lParam);
EndDialog(lpnm->hwndFrom, TRUE);
break;
case PSN_RESET :
//Handle a Cancel button click, if necessary
EndDialog(lpnm->hwndFrom, TRUE);
break;
default:
return 0;
}
}
return(TRUE);
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
// Bi-state options
g_curRomInfo.dwFrameBufferOption = (uint32_t) SendDlgItemMessage(hDlg, IDC_FRAME_BUFFER_SETTING, CB_GETCURSEL, 0, 0);
g_curRomInfo.dwRenderToTextureOption = (uint32_t) SendDlgItemMessage(hDlg, IDC_RENDER_TO_TEXTURE_SETTING, CB_GETCURSEL, 0, 0);
g_curRomInfo.UseCIWidthAndRatio = (uint32_t) SendDlgItemMessage(hDlg, IDC_USE_CI_WIDTH_AND_RATIO, CB_GETCURSEL, 0, 0);
// Less useful variables
g_curRomInfo.bIncTexRectEdge = (SendDlgItemMessage(hDlg, IDC_INCREASE_TEXTRECT_EDGE, BM_GETCHECK, 0, 0) == BST_CHECKED);
g_curRomInfo.bZHack = (SendDlgItemMessage(hDlg, IDC_Z_HACK, BM_GETCHECK, 0, 0) == BST_CHECKED);
g_curRomInfo.bPrimaryDepthHack = (SendDlgItemMessage(hDlg, IDC_PRIMARY_DEPTH_HACK, BM_GETCHECK, 0, 0) == BST_CHECKED);
g_curRomInfo.bTexture1Hack = (SendDlgItemMessage(hDlg, IDC_TEXTURE_1_HACK, BM_GETCHECK, 0, 0) == BST_CHECKED);
g_curRomInfo.bDisableCulling = (SendDlgItemMessage(hDlg, IDC_DISABLE_CULLING, BM_GETCHECK, 0, 0) == BST_CHECKED);
g_curRomInfo.bTxtSizeMethod2 = (SendDlgItemMessage(hDlg, IDC_TXT_SIZE_METHOD_2, BM_GETCHECK, 0, 0) == BST_CHECKED);
g_curRomInfo.bEnableTxtLOD = (SendDlgItemMessage(hDlg, IDC_ENABLE_LOD, BM_GETCHECK, 0, 0) == BST_CHECKED);
GetDlgItemText(hDlg,IDC_EDIT_WIDTH,generalText,255);
if( atol(generalText) > 100 )
{
g_curRomInfo.VIWidth = atol(generalText);
}
else
{
g_curRomInfo.VIWidth = 0;
}
GetDlgItemText(hDlg,IDC_EDIT_HEIGHT,generalText,255);
if( atol(generalText) > 100 )
{
g_curRomInfo.VIHeight = atol(generalText);
}
else
{
g_curRomInfo.VIHeight = 0;
}
GenerateCurrentRomOptions();
Ini_StoreRomOptions(&g_curRomInfo);
EndDialog(hDlg, TRUE);
return(TRUE);
case IDCANCEL:
EndDialog(hDlg, TRUE);
return(TRUE);
}
}
return FALSE;
}
LRESULT APIENTRY UnavailableProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG: