|
63 | 63 | #include <86box/video.h>
|
64 | 64 | #include <86box/machine.h>
|
65 | 65 | #include <86box/sound.h>
|
| 66 | +#include <86box/plat_unused.h> |
66 | 67 |
|
67 | 68 | typedef struct {
|
68 | 69 | int model;
|
@@ -242,6 +243,56 @@ ps1_read(uint16_t port, void *priv)
|
242 | 243 | return ret;
|
243 | 244 | }
|
244 | 245 |
|
| 246 | +static const device_config_t ps1_2011_config[] = { |
| 247 | + // clang-format off |
| 248 | + { |
| 249 | + .name = "bios_language", |
| 250 | + .description = "BIOS Language", |
| 251 | + .type = CONFIG_BIOS, |
| 252 | + .default_string = "english_us", |
| 253 | + .default_int = 0, |
| 254 | + .file_filter = "", |
| 255 | + .spinner = { 0 }, /*W1*/ |
| 256 | + .bios = { |
| 257 | + { .name = "English (US)", .internal_name = "english_us", .bios_type = BIOS_NORMAL, |
| 258 | + .files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/ibmps1es/FC0000_US.BIN", "" } }, |
| 259 | + { .name = "English (UK)", .internal_name = "english_uk", .bios_type = BIOS_NORMAL, |
| 260 | + .files_no = 2, .local = 0, .size = 262144, .files = { "roms/machines/ibmps1es/F80000_UK.BIN", "roms/machines/ibmps1es/FC0000_UK.BIN", "" } }, |
| 261 | + { .name = "English (Canada)", .internal_name = "english_ca", .bios_type = BIOS_NORMAL, |
| 262 | + .files_no = 2, .local = 0, .size = 262144, .files = { "roms/machines/ibmps1es/F80000_CA.BIN", "roms/machines/ibmps1es/FC0000_CA.BIN", "" } }, |
| 263 | + { .name = "Portuguese", .internal_name = "portuguese", .bios_type = BIOS_NORMAL, |
| 264 | + .files_no = 2, .local = 0, .size = 262144, .files = { "roms/machines/ibmps1es/F80000_PT.BIN", "roms/machines/ibmps1es/FC0000_PT.BIN", "" } }, |
| 265 | + { .name = "German", .internal_name = "german", .bios_type = BIOS_NORMAL, |
| 266 | + .files_no = 2, .local = 0, .size = 262144, .files = { "roms/machines/ibmps1es/F80000_DE.BIN", "roms/machines/ibmps1es/FC0000_DE.BIN", "" } }, |
| 267 | + { .name = "Swedish", .internal_name = "swedish", .bios_type = BIOS_NORMAL, |
| 268 | + .files_no = 2, .local = 0, .size = 262144, .files = { "roms/machines/ibmps1es/F80000_SE.BIN", "roms/machines/ibmps1es/FC0000_SE.BIN", "" } }, |
| 269 | + { .name = "French", .internal_name = "french", .bios_type = BIOS_NORMAL, |
| 270 | + .files_no = 2, .local = 0, .size = 262144, .files = { "roms/machines/ibmps1es/F80000_FR.BIN", "roms/machines/ibmps1es/FC0000_FR.BIN", "" } }, |
| 271 | + { .name = "Italian", .internal_name = "italian", .bios_type = BIOS_NORMAL, |
| 272 | + .files_no = 1, .local = 0, .size = 524288, .files = { "roms/machines/ibmps1es/f80000.bin", "" } }, |
| 273 | + { .name = "Spanish", .internal_name = "spanish", .bios_type = BIOS_NORMAL, |
| 274 | + .files_no = 1, .local = 0, .size = 524288, .files = { "roms/machines/ibmps1es/F80000_ES.bin", "" } }, |
| 275 | + { .files_no = 0 } |
| 276 | + }, |
| 277 | + }, |
| 278 | + { .name = "", .description = "", .type = CONFIG_END } |
| 279 | + // clang-format on |
| 280 | +}; |
| 281 | + |
| 282 | +const device_t ps1_2011_device = { |
| 283 | + .name = "PS/1 2011", |
| 284 | + .internal_name = "ps/1_2011", |
| 285 | + .flags = 0, |
| 286 | + .local = 0, |
| 287 | + .init = NULL, |
| 288 | + .close = NULL, |
| 289 | + .reset = NULL, |
| 290 | + { .available = NULL }, |
| 291 | + .speed_changed = NULL, |
| 292 | + .force_redraw = NULL, |
| 293 | + .config = &ps1_2011_config[0] |
| 294 | +}; |
| 295 | + |
245 | 296 | static void
|
246 | 297 | ps1_setup(int model)
|
247 | 298 | {
|
@@ -273,9 +324,27 @@ ps1_setup(int model)
|
273 | 324 | device_add(&ps_nvr_device);
|
274 | 325 |
|
275 | 326 | if (model == 2011) {
|
276 |
| - rom_init(&ps->high_rom, |
277 |
| - "roms/machines/ibmps1es/f80000.bin", |
278 |
| - 0xf80000, 0x80000, 0x7ffff, 0, MEM_MAPPING_EXTERNAL); |
| 327 | + if (!strcmp("english_us", device_get_config_bios("bios_language"))) { |
| 328 | + /* US English */ |
| 329 | + rom_init(&ps->high_rom, |
| 330 | + device_get_bios_file(device_context_get_device(), device_get_config_bios("bios_language"), 0), |
| 331 | + 0xfc0000, 0x40000, 0x3ffff, 0, MEM_MAPPING_EXTERNAL); |
| 332 | + |
| 333 | + } else if ((device_get_bios_file(device_context_get_device(), device_get_config_bios("bios_language"), 1)) == NULL) { |
| 334 | + /* Combined ROM. */ |
| 335 | + rom_init(&ps->high_rom, |
| 336 | + device_get_bios_file(device_context_get_device(), device_get_config_bios("bios_language"), 0), |
| 337 | + 0xf80000, 0x80000, 0x7ffff, 0, MEM_MAPPING_EXTERNAL); |
| 338 | + } else { |
| 339 | + /* Split ROM. */ |
| 340 | + rom_init(&ps->mid_rom, |
| 341 | + device_get_bios_file(device_context_get_device(), device_get_config_bios("bios_language"), 0), |
| 342 | + 0xf80000, 0x40000, 0x3ffff, 0, MEM_MAPPING_EXTERNAL); |
| 343 | + |
| 344 | + rom_init(&ps->high_rom, |
| 345 | + device_get_bios_file(device_context_get_device(), device_get_config_bios("bios_language"), 1), |
| 346 | + 0xfc0000, 0x40000, 0x3ffff, 0, MEM_MAPPING_EXTERNAL); |
| 347 | + } |
279 | 348 |
|
280 | 349 | lpt2_remove();
|
281 | 350 |
|
@@ -339,16 +408,43 @@ int
|
339 | 408 | machine_ps1_m2011_init(const machine_t *model)
|
340 | 409 | {
|
341 | 410 | int ret;
|
| 411 | + const char* fn; |
| 412 | + uint32_t offset; |
342 | 413 |
|
343 |
| - ret = bios_load_linear("roms/machines/ibmps1es/f80000.bin", |
344 |
| - 0x000e0000, 131072, 0x60000); |
| 414 | + if (!device_available(model->device)) { |
| 415 | + /* No ROMs available. */ |
| 416 | + return 0; |
| 417 | + } |
345 | 418 |
|
346 |
| - if (bios_only || !ret) |
| 419 | + device_context(model->device); |
| 420 | + if ((fn = device_get_bios_file(model->device, device_get_config_bios("bios_language"), 1)) == NULL) { |
| 421 | + /* Combined ROM or US English. */ |
| 422 | + fn = device_get_bios_file(model->device, device_get_config_bios("bios_language"), 0); |
| 423 | + offset = (!strcmp("english_us", device_get_config_bios("bios_language"))) ? 0x20000 : 0x60000; |
| 424 | + } else { |
| 425 | + /* Separated ROM. */ |
| 426 | + offset = 0x20000; |
| 427 | + } |
| 428 | + |
| 429 | + if (!fn) { |
| 430 | + fn = device_get_bios_file(model->device, "us_english", 0); |
| 431 | + offset = 0x20000; |
| 432 | + } |
| 433 | + |
| 434 | + ret = bios_load_linear(fn, 0x000e0000, 131072, offset); |
| 435 | + device_context_restore(); |
| 436 | + |
| 437 | + if (bios_only || !ret) { |
347 | 438 | return ret;
|
| 439 | + } |
348 | 440 |
|
349 | 441 | ps1_common_init(model);
|
350 | 442 |
|
351 |
| - ps1_setup(2011); |
| 443 | + device_context(model->device); |
| 444 | + |
| 445 | + ps1_setup(2011); |
| 446 | + |
| 447 | + device_context_restore(); |
352 | 448 |
|
353 | 449 | return ret;
|
354 | 450 | }
|
|
0 commit comments