@@ -20,8 +20,28 @@ GameSettings& GameSettings::instance(){
2020 static GameSettings settings;
2121 return settings;
2222}
23+ GameSettings::~GameSettings (){
24+ DEVICE.remove_listener (*this );
25+ GAME_BOX.remove_listener (*this );
26+ GAME_BOX.X .remove_listener (*this );
27+ GAME_BOX.Y .remove_listener (*this );
28+ GAME_BOX.WIDTH .remove_listener (*this );
29+ GAME_BOX.HEIGHT .remove_listener (*this );
30+ }
2331GameSettings::GameSettings ()
2432 : BatchOption(LockMode::LOCK_WHILE_RUNNING)
33+ , m_game_device_settings(" <font size=4><b>Game Device settings:</b></font>" )
34+ , DEVICE(
35+ " <b>Device:</b><br>Select the device the game is running on. "
36+ " Refer to the documentation for specific setups." ,
37+ {
38+ {Device::switch_1_2, " switch_1_2" , " Nintendo Switch 1 and 2" },
39+ // {Device::dev_test, "dev_test", "dev test rg35xx"},
40+ // {Device::custom, "custom", "Custom"},
41+ },
42+ LockMode::LOCK_WHILE_RUNNING,
43+ Device::switch_1_2
44+ )
2545 , GAME_BOX(
2646 " Game Box: The part of the screen containing the actual video feed." ,
2747 LockMode::LOCK_WHILE_RUNNING,
@@ -57,16 +77,53 @@ GameSettings::GameSettings()
5777 1000 , 0 , 48000 // 2000
5878 )
5979{
80+ PA_ADD_STATIC (m_game_device_settings);
81+ PA_ADD_OPTION (DEVICE);
6082 PA_ADD_STATIC (GAME_BOX);
6183 PA_ADD_STATIC (m_soft_reset_timings);
6284 PA_ADD_OPTION (SELECT_BUTTON_MASH0);
6385 PA_ADD_OPTION (ENTER_GAME_WAIT0);
6486 PA_ADD_STATIC (m_shiny_audio_settings);
6587 PA_ADD_OPTION (SHINY_SOUND_THRESHOLD);
6688 PA_ADD_OPTION (SHINY_SOUND_LOW_FREQUENCY);
67- }
6889
90+ GameSettings::on_config_value_changed (this );
91+ DEVICE.add_listener (*this );
92+ GAME_BOX.add_listener (*this );
93+ GAME_BOX.X .add_listener (*this );
94+ GAME_BOX.Y .add_listener (*this );
95+ GAME_BOX.WIDTH .add_listener (*this );
96+ GAME_BOX.HEIGHT .add_listener (*this );
97+ }
6998
99+ void GameSettings::on_config_value_changed (void * object){
100+ switch (DEVICE){
101+ case Device::switch_1_2:
102+ GAME_BOX.X .set (0.09375 );
103+ GAME_BOX.Y .set (0.00462963 );
104+ GAME_BOX.WIDTH .set (0.8125 );
105+ GAME_BOX.HEIGHT .set (0.962963 );
106+ GAME_BOX.set_visibility (ConfigOptionState::DISABLED);
107+ break ;
108+ case Device::dev_test:
109+ GAME_BOX.X .set (0.125 );
110+ GAME_BOX.Y .set (0.0564814814814815 );
111+ GAME_BOX.WIDTH .set (0.7494791666666667 );
112+ GAME_BOX.HEIGHT .set (0.8861111111111111 );
113+ GAME_BOX.set_visibility (ConfigOptionState::DISABLED);
114+ break ;
115+ case Device::custom:
116+ GAME_BOX.set_visibility (ConfigOptionState::ENABLED);
117+ break ;
118+ default :
119+ GAME_BOX.X .set (0.09375 );
120+ GAME_BOX.Y .set (0.00462963 );
121+ GAME_BOX.WIDTH .set (0.8125 );
122+ GAME_BOX.HEIGHT .set (0.962963 );
123+ GAME_BOX.set_visibility (ConfigOptionState::ENABLED);
124+ break ;
125+ }
126+ }
70127
71128
72129
0 commit comments