@@ -171,117 +171,117 @@ LibretroCore::LibretroCore(retro_log_printf_t log_cb_, int machineDetailedType_,
171171 if (enhancedRom)
172172 {
173173 bootframes = 20 *10 ;
174- config->memory .rom [0x00 ].file =romBasePath+ " exos24uk.rom" ;
174+ config->memory .rom [0x00 ].file =" exos24uk.rom" ;
175175 config->memory .rom [0x00 ].offset =0 ;
176- config->memory .rom [0x01 ].file =romBasePath+ " exos24uk.rom" ;
176+ config->memory .rom [0x01 ].file =" exos24uk.rom" ;
177177 config->memory .rom [0x01 ].offset =16384 ;
178- config->memory .rom [0x02 ].file =romBasePath+ " exos24uk.rom" ;
178+ config->memory .rom [0x02 ].file =" exos24uk.rom" ;
179179 config->memory .rom [0x02 ].offset =32768 ;
180- config->memory .rom [0x03 ].file =romBasePath+ " exos24uk.rom" ;
180+ config->memory .rom [0x03 ].file =" exos24uk.rom" ;
181181 config->memory .rom [0x03 ].offset =49152 ;
182182 }
183183 else if (is_EP64)
184184 {
185185 bootframes = 30 *10 ;
186- config->memory .rom [0x00 ].file =romBasePath+ " exos20.rom" ;
186+ config->memory .rom [0x00 ].file =" exos20.rom" ;
187187 config->memory .rom [0x00 ].offset =0 ;
188- config->memory .rom [0x01 ].file =romBasePath+ " exos20.rom" ;
188+ config->memory .rom [0x01 ].file =" exos20.rom" ;
189189 config->memory .rom [0x01 ].offset =16384 ;
190190 }
191191 else
192192 {
193193 bootframes = 40 *10 ;
194- config->memory .rom [0x00 ].file =romBasePath+ " exos21.rom" ;
194+ config->memory .rom [0x00 ].file =" exos21.rom" ;
195195 config->memory .rom [0x00 ].offset =0 ;
196- config->memory .rom [0x01 ].file =romBasePath+ " exos21.rom" ;
196+ config->memory .rom [0x01 ].file =" exos21.rom" ;
197197 config->memory .rom [0x01 ].offset =16384 ;
198198 }
199199 if (contentLocale == LOCALE_HUN )
200200 {
201201 // Locale support: HUN ROM goes to segment 4 and then Basic goes to segment 5
202- config->memory .rom [0x04 ].file =romBasePath+ " hun.rom" ;
202+ config->memory .rom [0x04 ].file =" hun.rom" ;
203203 config->memory .rom [0x04 ].offset =0 ;
204204 if (use_cartridge) {
205205 if (is_EP64)
206- config->memory .rom [0x05 ].file =romBasePath+ " basic20.rom" ;
206+ config->memory .rom [0x05 ].file =" basic20.rom" ;
207207 else
208- config->memory .rom [0x05 ].file =romBasePath+ " basic21.rom" ;
208+ config->memory .rom [0x05 ].file =" basic21.rom" ;
209209 config->memory .rom [0x05 ].offset =0 ;
210210 }
211211 // HFONT is used from epdos rom (and CLKOFF, as it is not present after this 1.6f version)
212- config->memory .rom [0x06 ].file =romBasePath+ " epdos16f.rom" ;
212+ config->memory .rom [0x06 ].file =" epdos16f.rom" ;
213213 config->memory .rom [0x06 ].offset =0 ;
214- config->memory .rom [0x07 ].file =romBasePath+ " epdos16f.rom" ;
214+ config->memory .rom [0x07 ].file =" epdos16f.rom" ;
215215 config->memory .rom [0x07 ].offset =16384 ;
216216 }
217217 else if (contentLocale == LOCALE_GER )
218218 {
219219 // Locale support: BRD ROM goes to segment 4 and then Basic goes to segment 5
220- config->memory .rom [0x04 ].file =romBasePath+ " brd.rom" ;
220+ config->memory .rom [0x04 ].file =" brd.rom" ;
221221 config->memory .rom [0x04 ].offset =0 ;
222222 if (use_cartridge) {
223223 if (is_EP64)
224- config->memory .rom [0x05 ].file =romBasePath+ " basic20.rom" ;
224+ config->memory .rom [0x05 ].file =" basic20.rom" ;
225225 else
226- config->memory .rom [0x05 ].file =romBasePath+ " basic21.rom" ;
226+ config->memory .rom [0x05 ].file =" basic21.rom" ;
227227 config->memory .rom [0x05 ].offset =0 ;
228228 }
229229 }
230230 else
231231 {
232232 if (use_cartridge) {
233233 if (is_EP64)
234- config->memory .rom [0x04 ].file =romBasePath+ " basic20.rom" ;
234+ config->memory .rom [0x04 ].file =" basic20.rom" ;
235235 else
236- config->memory .rom [0x05 ].file =romBasePath+ " basic21.rom" ;
236+ config->memory .rom [0x05 ].file =" basic21.rom" ;
237237 config->memory .rom [0x04 ].offset =0 ;
238238 }
239239 }
240240
241241 if (use_file || use_dtf)
242242 {
243- config->memory .rom [0x10 ].file =romBasePath+ " epfileio.rom" ;
243+ config->memory .rom [0x10 ].file =" epfileio.rom" ;
244244 config->memory .rom [0x10 ].offset =0 ;
245245 if (use_dtf)
246246 {
247- config->memory .rom [0x40 ].file =romBasePath+ " zt19uk.rom" ;
247+ config->memory .rom [0x40 ].file =" zt19uk.rom" ;
248248 config->memory .rom [0x40 ].offset =0 ;
249- config->memory .rom [0x41 ].file =romBasePath+ " zt19uk.rom" ;
249+ config->memory .rom [0x41 ].file =" zt19uk.rom" ;
250250 config->memory .rom [0x41 ].offset =16384 ;
251251 }
252252 }
253253 if (use_isdos)
254254 {
255- config->memory .rom [0x20 ].file =romBasePath+ " exdos14isdos10uk.rom" ;
255+ config->memory .rom [0x20 ].file =" exdos14isdos10uk.rom" ;
256256 config->memory .rom [0x20 ].offset =0 ;
257- config->memory .rom [0x21 ].file =romBasePath+ " exdos14isdos10uk.rom" ;
257+ config->memory .rom [0x21 ].file =" exdos14isdos10uk.rom" ;
258258 config->memory .rom [0x21 ].offset =16384 ;
259259 startSequence += " \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff " " \x27 " " isdos\r " " \xff\xff\xff\xff\xff\xff\xff " " dir\r " ;
260260 }
261261 else if (use_file || use_disk)
262262 {
263- config->memory .rom [0x20 ].file =romBasePath+ " exdos13.rom" ;
263+ config->memory .rom [0x20 ].file =" exdos13.rom" ;
264264 config->memory .rom [0x20 ].offset =0 ;
265- config->memory .rom [0x21 ].file =romBasePath+ " exdos13.rom" ;
265+ config->memory .rom [0x21 ].file =" exdos13.rom" ;
266266 config->memory .rom [0x21 ].offset =16384 ;
267267 }
268268 }
269269 else if (machineType == MACHINE_TVC )
270270 {
271271 bootframes = 50 *10 ;
272272 config->memory .ram .size =128 ;
273- config->memory .rom [0x00 ].file =romBasePath+ " tvc22_sys.rom" ;
273+ config->memory .rom [0x00 ].file =" tvc22_sys.rom" ;
274274 config->memory .rom [0x00 ].offset =0 ;
275- config->memory .rom [0x02 ].file =romBasePath+ " tvc22_ext.rom" ;
275+ config->memory .rom [0x02 ].file =" tvc22_ext.rom" ;
276276 config->memory .rom [0x02 ].offset =0 ;
277277 if (machineDetailedType == VM_config.at (" TVC64_FILE" ))
278278 {
279- config->memory .rom [0x04 ].file =romBasePath+ " tvcfileio.rom" ;
279+ config->memory .rom [0x04 ].file =" tvcfileio.rom" ;
280280 config->memory .rom [0x04 ].offset =0 ;
281281 }
282282 if (machineDetailedType == VM_config.at (" TVC64_DISK" ))
283283 {
284- config->memory .rom [0x03 ].file =romBasePath+ " tvc_dos12d.rom" ;
284+ config->memory .rom [0x03 ].file =" tvc_dos12d.rom" ;
285285 config->memory .rom [0x03 ].offset =0 ;
286286 }
287287 }
@@ -292,31 +292,31 @@ LibretroCore::LibretroCore(retro_log_printf_t log_cb_, int machineDetailedType_,
292292 if (machineDetailedType == VM_config.at (" CPC_464_TAPE" ))
293293 {
294294 config->memory .ram .size =64 ;
295- config->memory .rom [0x10 ].file =romBasePath+ " cpc464.rom" ;
295+ config->memory .rom [0x10 ].file =" cpc464.rom" ;
296296 config->memory .rom [0x10 ].offset =0 ;
297- config->memory .rom [0x00 ].file =romBasePath+ " cpc464.rom" ;
297+ config->memory .rom [0x00 ].file =" cpc464.rom" ;
298298 config->memory .rom [0x00 ].offset =16384 ;
299299 }
300300 else if (machineDetailedType == VM_config.at (" CPC_664_DISK" ))
301301 {
302302 config->memory .ram .size =64 ;
303- config->memory .rom [0x10 ].file =romBasePath+ " cpc664.rom" ;
303+ config->memory .rom [0x10 ].file =" cpc664.rom" ;
304304 config->memory .rom [0x10 ].offset =0 ;
305- config->memory .rom [0x00 ].file =romBasePath+ " cpc664.rom" ;
305+ config->memory .rom [0x00 ].file =" cpc664.rom" ;
306306 config->memory .rom [0x00 ].offset =16384 ;
307307 }
308308 else
309309 {
310310 // 6128 as default
311311 config->memory .ram .size =128 ;
312- config->memory .rom [0x10 ].file =romBasePath+ " cpc6128.rom" ;
312+ config->memory .rom [0x10 ].file =" cpc6128.rom" ;
313313 config->memory .rom [0x10 ].offset =0 ;
314- config->memory .rom [0x00 ].file =romBasePath+ " cpc6128.rom" ;
314+ config->memory .rom [0x00 ].file =" cpc6128.rom" ;
315315 config->memory .rom [0x00 ].offset =16384 ;
316316 }
317317 if (machineDetailedType == VM_config.at (" CPC_DISK" ) || machineDetailedType == VM_config.at (" CPC_664_DISK" ))
318318 {
319- config->memory .rom [0x07 ].file =romBasePath+ " cpc_amsdos.rom" ;
319+ config->memory .rom [0x07 ].file =" cpc_amsdos.rom" ;
320320 config->memory .rom [0x07 ].offset =0 ;
321321 }
322322
@@ -339,23 +339,92 @@ LibretroCore::LibretroCore(retro_log_printf_t log_cb_, int machineDetailedType_,
339339
340340 if (machineDetailedType == VM_config.at (" ZX128_TAPE" ) || machineDetailedType == VM_config.at (" ZX128_FILE" ))
341341 {
342- config->memory .rom [0x00 ].file =romBasePath+ " zx128.rom" ;
342+ config->memory .rom [0x00 ].file =" zx128.rom" ;
343343 config->memory .rom [0x00 ].offset =0 ;
344- config->memory .rom [0x01 ].file =romBasePath+ " zx128.rom" ;
344+ config->memory .rom [0x01 ].file =" zx128.rom" ;
345345 config->memory .rom [0x01 ].offset =16384 ;
346346 }
347347 else
348348 {
349- config->memory .rom [0x00 ].file =romBasePath+ " zx48.rom" ;
349+ config->memory .rom [0x00 ].file =" zx48.rom" ;
350350 config->memory .rom [0x00 ].offset =0 ;
351351 }
352352 }
353+
354+ if (machineType == MACHINE_EP )
355+ {
356+ config->vm .cpuClockFrequency =4000000 ;
357+ config->vm .enableMemoryTimingEmulation =true ;
358+ config->vm .soundClockFrequency =500000 ;
359+ config->vm .videoClockFrequency =889846 ;
360+ }
361+ else if (machineType == MACHINE_TVC )
362+ {
363+ config->vm .cpuClockFrequency =3125000 ;
364+ config->vm .enableMemoryTimingEmulation =true ;
365+ config->vm .soundClockFrequency =390625 ;
366+ config->vm .videoClockFrequency =1562500 ;
367+ }
368+ else if (machineType == MACHINE_CPC )
369+ {
370+ config->vm .cpuClockFrequency =4000000 ;
371+ config->vm .enableMemoryTimingEmulation =true ;
372+ config->vm .soundClockFrequency =125000 ;
373+ config->vm .videoClockFrequency =1000000 ;
374+ }
375+ else if (machineType == MACHINE_ZX )
376+ {
377+ if (machineDetailedType == VM_config.at (" ZX128_TAPE" ) || machineDetailedType == VM_config.at (" ZX128_FILE" ))
378+ {
379+ config->vm .cpuClockFrequency =3546896 ;
380+ config->vm .soundClockFrequency =221681 ;
381+ config->vm .videoClockFrequency =886724 ;
382+ }
383+ else
384+ {
385+ config->vm .cpuClockFrequency =3500000 ;
386+ config->vm .soundClockFrequency =218750 ;
387+ config->vm .videoClockFrequency =875000 ;
388+ }
389+ config->vm .enableMemoryTimingEmulation =true ;
390+ }
391+ config->vmConfigurationChanged = true ;
392+
393+ config->sound .sampleRate = EP128EMU_SAMPLE_RATE_FLOAT ;
394+ config->sound .hwPeriods = 16 ;
395+ // config->sound.swPeriods = 16;
396+ // config->sound.enabled = false;
397+ config->sound .highQuality = true ;
398+ config->soundSettingsChanged = true ;
399+
400+ // Reload config files to enforce priority of settings.
401+ if (Ep128Emu::does_file_exist (configBaseFile.c_str ()))
402+ {
403+ config->loadState (configBaseFile.c_str (),false );
404+ }
405+ // highest: content-specific file
406+ if (cfgFile[0 ])
407+ {
408+ config->loadState (cfgFile,false );
409+ }
410+
353411 // ROM validity check: scan ROM definitions and check if files can be be found.
354412 // If not, try to use replacement file
355413 for (int i=0 ; i<68 ; i++)
356414 {
357415 if (config->memory .rom [i].file .length ()>0 )
358416 {
417+ // Prepend romBasePath if the rom name is not a path already (useful for rom settings read from .ep128cfg)
418+ #ifdef WIN32
419+ size_t idx = config->memory .rom [i].file .rfind (' \\ ' );
420+ #else
421+ size_t idx = config->memory .rom [i].file .rfind (' /' );
422+ #endif
423+ if (idx == std::string::npos)
424+ {
425+ config->memory .rom [i].file =romBasePath+config->memory .rom [i].file ;
426+ }
427+
359428 if (!Ep128Emu::does_file_exist (config->memory .rom [i].file .c_str ()))
360429 {
361430 std::map< std::string, std::string >::const_iterator iter_altrom;
@@ -422,65 +491,8 @@ LibretroCore::LibretroCore(retro_log_printf_t log_cb_, int machineDetailedType_,
422491 }
423492 }
424493 }
425- config->memoryConfigurationChanged = true ;
426-
427- if (machineType == MACHINE_EP )
428- {
429- config->vm .cpuClockFrequency =4000000 ;
430- config->vm .enableMemoryTimingEmulation =true ;
431- config->vm .soundClockFrequency =500000 ;
432- config->vm .videoClockFrequency =889846 ;
433- }
434- else if (machineType == MACHINE_TVC )
435- {
436- config->vm .cpuClockFrequency =3125000 ;
437- config->vm .enableMemoryTimingEmulation =true ;
438- config->vm .soundClockFrequency =390625 ;
439- config->vm .videoClockFrequency =1562500 ;
440- }
441- else if (machineType == MACHINE_CPC )
442- {
443- config->vm .cpuClockFrequency =4000000 ;
444- config->vm .enableMemoryTimingEmulation =true ;
445- config->vm .soundClockFrequency =125000 ;
446- config->vm .videoClockFrequency =1000000 ;
447- }
448- else if (machineType == MACHINE_ZX )
449- {
450- if (machineDetailedType == VM_config.at (" ZX128_TAPE" ) || machineDetailedType == VM_config.at (" ZX128_FILE" ))
451- {
452- config->vm .cpuClockFrequency =3546896 ;
453- config->vm .soundClockFrequency =221681 ;
454- config->vm .videoClockFrequency =886724 ;
455- }
456- else
457- {
458- config->vm .cpuClockFrequency =3500000 ;
459- config->vm .soundClockFrequency =218750 ;
460- config->vm .videoClockFrequency =875000 ;
461- }
462- config->vm .enableMemoryTimingEmulation =true ;
463- }
464- config->vmConfigurationChanged = true ;
465-
466- config->sound .sampleRate = EP128EMU_SAMPLE_RATE_FLOAT ;
467- config->sound .hwPeriods = 16 ;
468- // config->sound.swPeriods = 16;
469- // config->sound.enabled = false;
470- config->sound .highQuality = true ;
471- config->soundSettingsChanged = true ;
472-
473- // Reload config files to enforce priority of settings.
474- if (Ep128Emu::does_file_exist (configBaseFile.c_str ()))
475- {
476- config->loadState (configBaseFile.c_str (),false );
477- }
478- // highest: content-specific file
479- if (cfgFile[0 ])
480- {
481- config->loadState (cfgFile,false );
482- }
483-
494+ config->memoryConfigurationChanged = true ;
495+
484496 initialize_keyboard_map ();
485497 initialize_joystick_map (std::string (" " ),std::string (" " ),std::string (" " ),-1 ,
486498 joystick_type.at (" DEFAULT" ), joystick_type.at (" DEFAULT" ), joystick_type.at (" DEFAULT" ),
0 commit comments