@@ -56,11 +56,12 @@ def _write_int(writer: IO[bytes], data: int, /) -> None:
5656@dataclass (slots = True )
5757class _OpenJazzConfig :
5858 path : Path
59- version : int = 6
59+ version : int = 7
6060 video_width : int = 640
6161 video_height : int = 480
6262 fullscreen : bool = True
6363 video_scale : int = 1
64+ scale_method : int = 0
6465 keys : list [int ] = field (default_factory = lambda : [
6566 1073741906 , # Up
6667 1073741905 , # Down
@@ -148,18 +149,20 @@ class _OpenJazzConfig:
148149 many_birds : bool = False
149150 leave_unneeded : bool = False
150151 slow_motion : bool = False
151- scale_2x : bool = True
152+ hud_fps : bool = False
152153
153154 def save (self ) -> None :
154155 _logger .info ("Saving configuration" )
155156 try :
156157 with self .path .open ('wb' ) as f :
157158 # Version
158- _write_char (f , 6 )
159+ _write_char (f , 7 )
159160
160161 _write_short (f , self .video_width )
161162 _write_short (f , self .video_height )
162- _write_char (f , (self .video_scale << 1 ) | self .fullscreen )
163+ _write_char (f , self .fullscreen )
164+ _write_char (f , self .video_scale )
165+ _write_char (f , self .scale_method )
163166
164167 for key in self .keys :
165168 _write_int (f , key )
@@ -183,7 +186,7 @@ def save(self) -> None:
183186
184187 _write_char (f , self .music_volume )
185188 _write_char (f , self .sound_volume )
186- _write_char (f , self .many_birds | (self .leave_unneeded << 1 ) | (self .slow_motion << 2 ) | (self .scale_2x << 3 ))
189+ _write_char (f , self .many_birds | (self .leave_unneeded << 1 ) | (self .slow_motion << 2 ) | (self .hud_fps << 3 ))
187190 except Exception :
188191 _logger .exception ("Error saving configuration" )
189192
@@ -209,14 +212,9 @@ def load(cls, path: Path, /) -> Self:
209212 video_width = _read_short (f )
210213 video_height = _read_short (f )
211214
212- video_options = _read_char (f )
213-
214- fullscreen = bool (video_options & 1 )
215-
216- if video_options >= 10 :
217- video_options = 2
218-
219- video_scale = video_options >> 1
215+ fullscreen = bool (_read_char (f ))
216+ video_scale = _read_char (f )
217+ scale_method = _read_char (f )
220218
221219 keys = [_read_int (f ) for _ in range (_CONTROLS - 4 )]
222220 buttons = [_read_int (f ) for _ in range (_CONTROLS )]
@@ -234,7 +232,7 @@ def load(cls, path: Path, /) -> Self:
234232 many_birds = bool (opts & 1 )
235233 leave_unneeded = bool (opts & 2 )
236234 slow_motion = bool (opts & 4 )
237- scale_2x = not bool (opts & 8 )
235+ hud_fps = bool (opts & 8 )
238236
239237 return cls (
240238 path ,
@@ -243,6 +241,7 @@ def load(cls, path: Path, /) -> Self:
243241 video_height = video_height ,
244242 fullscreen = fullscreen ,
245243 video_scale = video_scale ,
244+ scale_method = scale_method ,
246245 keys = keys ,
247246 buttons = buttons ,
248247 axes = axes ,
@@ -254,7 +253,7 @@ def load(cls, path: Path, /) -> Self:
254253 many_birds = many_birds ,
255254 leave_unneeded = leave_unneeded ,
256255 slow_motion = slow_motion ,
257- scale_2x = scale_2x ,
256+ hud_fps = hud_fps ,
258257 )
259258 except Exception :
260259 _logger .exception ('Error loading configuration' )
@@ -275,14 +274,15 @@ def print_config(self, cfg: _OpenJazzConfig, /):
275274 _logger .info ("Resolution: %sx%s" , cfg .video_width , cfg .video_height )
276275 _logger .info ("Fullscreen: %s" , cfg .fullscreen )
277276 _logger .info ("Video Scale: %s" , cfg .video_scale )
277+ _logger .info ("Scale Method: %s" , cfg .scale_method )
278278 _logger .info ("Character Name: %s" , cfg .character_name )
279279 _logger .info ("Character Colors: %s" , cfg .character_colors )
280280 _logger .info ("Music Volume: %s" , cfg .music_volume )
281281 _logger .info ("Sound Volume: %s" , cfg .sound_volume )
282282 _logger .info ("Many Birds: %s" , cfg .many_birds )
283283 _logger .info ("Leave Unneeded: %s" , cfg .leave_unneeded )
284284 _logger .info ("Slow Motion: %s" , cfg .slow_motion )
285- _logger .info ("Scale2x : %s" , cfg .scale_2x )
285+ _logger .info ("HUD FPS : %s" , cfg .hud_fps )
286286 _logger .info ("Controls Configuration:" )
287287 _logger .info ("Keys: %s" , cfg .keys )
288288 _logger .info ("Buttons: %s" , cfg .buttons )
@@ -336,6 +336,12 @@ def generate(self, system, rom, playersControllers, metadata, guns, wheels, game
336336 cfg .video_width = int (width_str )
337337 cfg .video_height = int (height_str )
338338
339+ # Scaler: 0=None, 1=Bilinear, 2=Scale2x, 3=hqx
340+ cfg .scale_method = int (system .config .get ("jazz_scaler" , "0" ))
341+
342+ # Integer pixel-scale factor (clamped 1-4 by the engine)
343+ cfg .video_scale = int (system .config .get ("jazz_video_scale" , "1" ))
344+
339345 # Save the changes
340346 cfg .save ()
341347
0 commit comments