Skip to content

Commit 0ac0478

Browse files
committed
include roms directly
1 parent ab31fb1 commit 0ac0478

File tree

5 files changed

+4290
-48
lines changed

5 files changed

+4290
-48
lines changed

src/libretro/adapters.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ return path;
99
}
1010
std::string GetAssetPath(const std::string &f0, const std::string &f1)
1111
{
12-
std::string path = f0+"/"+f1;
12+
std::string path = f0+PATH_SEPARATOR+f1;
1313
printf ("GetAssetPath: %s\n",path.c_str());
1414
return path;
1515
}
@@ -68,13 +68,15 @@ bool LoadFile(std::vector<uint8_t> *data,
6868
Messages *messages,
6969
uint32_t flags)
7070
{
71-
printf ("LoadFile: %s\n",path);
71+
printf ("LoadFile: %s\n",path.c_str());
72+
return false;
7273
}
7374
bool SaveFile(const std::vector<uint8_t> &data, const std::string &path, Messages *messages)
7475
{
7576
printf ("SaveFile: %s\n",path.c_str());
77+
return false;
7678
}
77-
79+
/*
7880
std::shared_ptr<const std::array<uint8_t, 16384>> LoadROM(const std::string &name) {
7981
// TODO: use system dir
8082
std::string path = "/media/storage/Documents/dev/b2-libretro/rom/"+ name;
@@ -90,4 +92,4 @@ std::shared_ptr<const std::array<uint8_t, 16384>> LoadROM(const std::string &nam
9092
}
9193
9294
return rom;
93-
}
95+
}*/

src/libretro/adapters.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
#include <stdint.h>
66
#include "../b2/Messages.h"
77

8+
#ifdef _WIN32
9+
const char PATH_SEPARATOR = '\\';
10+
#else
11+
const char PATH_SEPARATOR = '/';
12+
#endif // _WIN32
13+
814
std::string GetAssetPath(const std::string &f0);
915
std::string GetAssetPath(const std::string &f0, const std::string &f1);
1016
bool GetFileDetails(size_t *size, bool *can_write, const char *path);
@@ -17,7 +23,7 @@ bool LoadFile(std::vector<uint8_t> *data,
1723
Messages *messages,
1824
uint32_t flags = 0);
1925
bool SaveFile(const std::vector<uint8_t> &data, const std::string &path, Messages *messages);
20-
std::shared_ptr<const std::array<uint8_t, 16384>> LoadROM(const std::string &name);
26+
/*std::shared_ptr<const std::array<uint8_t, 16384>> LoadROM(const std::string &name);*/
2127
/*
2228
class AudioDeviceLock {
2329
public:

src/libretro/b2_libretro.info

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
## All data is optional, but helps improve user experience.
2+
3+
# Software Information - Information about the core software itself
4+
# Name displayed when the user is selecting the core:
5+
display_name = "Acorn - BBC Micro (b2)"
6+
7+
# Categories that the core belongs to (optional):
8+
categories = "Emulator"
9+
10+
# Name of the authors who wrote the core:
11+
authors = "TBA"
12+
13+
# Name of the core:
14+
corename = "b2"
15+
16+
# List of extensions the core supports:
17+
supported_extensions = "ssd|dsd"
18+
19+
# License of the cores source code:
20+
license = "GPLv2"
21+
22+
# Privacy-specific permissions needed for using the core:
23+
permissions = ""
24+
25+
# Version of the core:
26+
display_version = "v0.1"
27+
28+
# Hardware Information - Information about the hardware the core supports (when applicable)
29+
# Name of the manufacturer who produced the emulated system:
30+
manufacturer = "Acorn"
31+
32+
# Name of the system that the core targets (optional):
33+
systemname = "BBC Micro"
34+
35+
# ID of the primary platform the core uses. Use other core info files as guidance if possible.
36+
# If blank or not used, a standard core platform will be used (optional):
37+
systemid = "bbcmicro"
38+
39+
# The number of mandatory/optional firmware files the core needs:
40+
# firmware_count = 0
41+
42+
# Libretro Features - The libretro API features the core supports. Useful for sorting cores
43+
# Does the core support savestates
44+
savestate = "false"
45+
# If true, how complete is the savestate support? basic, serialized (rewind), deterministic (netplay/runahead)
46+
savestate_features = "serialized"
47+
# Does the core support the libretro cheat interface?
48+
cheats = "false"
49+
# Does the core support libretro input descriptors
50+
input_descriptors = "true"
51+
# Does the core support memory descriptors commonly used for achievements
52+
memory_descriptors = "false"
53+
# Does the core use the libretro save interface or does it do its own thing (like with shared memory cards)?
54+
libretro_saves = "false"
55+
# Does the core support the core options interface?
56+
core_options = "true"
57+
# What version of core options is supported? (later versions allow for localization and descriptions)
58+
core_options_version = "1.0"
59+
# Does the core support the subsystem interface? Commonly used for chained/special loading, such as Super Game Boy
60+
load_subsystem = "false"
61+
# Whether or not the core requires an external file to work:
62+
supports_no_game = "true"
63+
# Does the core have a single purpose? Does it represent one game or application, requiring predetermined support files or no external data? Used to indicate to a frontend that the core may be presented/handled independently from 'regular' cores that run a variety of content.
64+
single_purpose = "false"
65+
# Name of the database that the core supports (optional):
66+
# database = ""
67+
# Does the core support/require support for libretro-gl or other hardware-acceleration in the frontend?
68+
hw_render = "false"
69+
# Which hardware-rendering APIs does the core support? Delimited by pipe characters.
70+
# required_hw_api = "Vulkan >= 1.0 | Direct3D >= 10.0 | OpenGL Core >= 3.3 | OpenGL ES >= 3.0"
71+
# Does the core require ongoing access to the file after loading? Mostly used for softpatching and streaming of data
72+
needs_fullpath = "true"
73+
# Does the core support the libretro disk control interface for swapping disks on the fly?
74+
disk_control = "true"
75+
# Is the core currently suitable for general use? That is, will regular users find it useful or is it for development/testing only (subject to change over time)?
76+
is_experimental = "true"
77+
78+
# Descriptive text, useful for tooltips, etc.
79+
description = "Emulate the Z80 based home computers that the original ep128emu supports - that is, Enterprise 64/128, Videoton TVC, Amstrad CPC and ZX Spectrum. Focus is on Enterprise and TVC."

src/libretro/core.cpp

Lines changed: 73 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,76 @@
11
/* TODO
22
3-
sudo docker run --rm -v "/media/storage/Documents/dev/b2-libretro:/build" git.libretro.com:5050/libretro-infrastructure/libretro-build-mxe-win32-cross:gcc10 bash -c "cd /build/src/libretro && make clean && make -j6"
4-
5-
export platform=win32
6-
export ARCH=x86
7-
export MSYSTEM=MINGW32
8-
export AR=i686-w64-mingw32.static-ar
9-
export AS=i686-w64-mingw32.static-as
10-
export CC=i686-w64-mingw32.static-gcc
11-
export CXX=i686-w64-mingw32.static-g++
12-
export WINDRES=i686-w64-mingw32.static-windres
13-
14-
15-
manage static 6502_internal.inl
16-
joypad controls
3+
sudo docker run -it --rm -v "/media/storage/Documents/dev/b2-libretro:/build" git.libretro.com:5050/libretro-infrastructure/libretro-build-mxe-win32-cross:gcc10 bash
4+
5+
export platform=win32
6+
export ARCH=x86
7+
export MSYSTEM=MINGW32
8+
export AR=i686-w64-mingw32.static-ar
9+
export AS=i686-w64-mingw32.static-as
10+
export CC=i686-w64-mingw32.static-gcc
11+
export CXX=i686-w64-mingw32.static-g++
12+
export WINDRES=i686-w64-mingw32.static-windres
13+
cd /build/src/libretro
14+
make clean
15+
make -j6
16+
17+
sudo docker run -it --rm -v "/media/storage/Documents/dev/b2-libretro:/build" git.libretro.com:5050/libretro-infrastructure/libretro-build-mxe-win-cross-cores:gcc11 bash
18+
19+
export platform=win64
20+
export ARCH=x86_64
21+
export MSYSTEM=MINGW64
22+
export AR=x86_64-w64-mingw32.static-ar
23+
export AS=x86_64-w64-mingw32.static-as
24+
export CC=x86_64-w64-mingw32.static-gcc
25+
export CXX=x86_64-w64-mingw32.static-g++
26+
export WINDRES=x86_64-w64-mingw32.static-windres
27+
cd /build/src/libretro
28+
make clean
29+
make -j6
30+
31+
32+
compilation:
33+
manage static 6502_internal.inl - probably to stay
34+
compile in ROMs, remove remaining path dependency (no file operations to remain)
35+
test Win32/64, OSX, PS2, etc.
36+
remove not needed source files + ifdef changes
1737
1838
core options
1939
autoboot on/off
20-
machine model
21-
22-
load game with disc input (paste?)
23-
set shift state on initial boot?
24-
25-
include roms in .h
26-
run main cycle until screen update
27-
28-
different controls
29-
30-
fix sound distortion - more or less OK
31-
use more sane sample rate than 250kHz
32-
33-
save state
34-
load uef?
35-
database
36-
37-
tape input?
38-
hook up reset
39-
disc autostart?
40-
intelligent zoom?
41-
graphics line check (interlace, etc)?
40+
machine model - build in JSON
41+
selectable joypad controls (azop, az/', etc.)
42+
fully customizable joypad controls
43+
44+
speed / accuracy:
45+
run main cycle until screen update
46+
fix sound distortion - more or less OK
47+
use more sane sample rate than 250kHz
4248
*tv0,0 *tv0,1 are not different for some reason? test program?
4349
fake interlace - based on register?
4450
45-
}
51+
functions:
52+
hook up reset
53+
save state
54+
load uef?
55+
LED support
56+
analog joystick, test program?
57+
digital joystick, test program?
58+
beeblink?
59+
printer?
60+
drive (and relay?) sound
61+
62+
main QoL
63+
load game with disc input (paste?)
64+
intelligent zoom?
65+
keyboard layouts?
66+
67+
other QoL
68+
overlay for LED display
69+
SVG icon
70+
database
71+
game-DB similar to CPC?
72+
tape input - not in b2 yet
73+
4674
4775
*/
4876
#include <stdio.h>
@@ -60,6 +88,7 @@ graphics line check (interlace, etc)?
6088
#include "../b2/filters.h"
6189
#include "../shared/h/shared/path.h"
6290
#include "core.h"
91+
#include "roms.hpp"
6392
#include "libretro.h"
6493
#include "adapters.h"
6594
#include "b2_libretro_keymap.h"
@@ -556,9 +585,10 @@ void retro_init(void)
556585
//core = new BBCMicro(&BBC_MICRO_TYPE_B,&DISC_INTERFACE_ACORN_1770,BBCMicroParasiteType_None,{},nullptr,0,nullptr,{0});
557586
//core = new BBCMicro(&BBC_MICRO_TYPE_B,nullptr,BBCMicroParasiteType_None,{},nullptr,0,nullptr,{0});
558587
core = new BBCMicro(&BBC_MICRO_TYPE_B,&DISC_INTERFACE_ACORN_1770,BBCMicroParasiteType_None,{},nullptr,0,nullptr,{0});
559-
core->SetOSROM(LoadROM("OS12.ROM"));
560-
core->SetSidewaysROM(15, LoadROM("BASIC2.ROM"));
561-
core->SetSidewaysROM(14, LoadROM("DFS-2.26.ROM"));
588+
589+
core->SetOSROM( std::make_shared<std::array<unsigned char, 16384>>(OS12_ROM));
590+
core->SetSidewaysROM(15, std::make_shared<std::array<unsigned char, 16384>>(BASIC2_ROM));
591+
core->SetSidewaysROM(14, std::make_shared<std::array<unsigned char, 16384>>(acorn_DFS_2_26_rom));
562592

563593
// tv = TVOutput();
564594

@@ -1023,9 +1053,9 @@ bool retro_load_game(const struct retro_game_info *info)
10231053
log_cb(RETRO_LOG_INFO, "Loading game: %s \n",info->path);
10241054

10251055
core = new BBCMicro(&BBC_MICRO_TYPE_B,&DISC_INTERFACE_ACORN_1770,BBCMicroParasiteType_None,{},nullptr,0,nullptr,{0});
1026-
core->SetOSROM(LoadROM("OS12.ROM"));
1027-
core->SetSidewaysROM(15, LoadROM("BASIC2.ROM"));
1028-
core->SetSidewaysROM(14, LoadROM("DFS-2.26.ROM"));
1056+
core->SetOSROM( std::make_shared<std::array<unsigned char, 16384>>(OS12_ROM));
1057+
core->SetSidewaysROM(15, std::make_shared<std::array<unsigned char, 16384>>(BASIC2_ROM));
1058+
core->SetSidewaysROM(14, std::make_shared<std::array<unsigned char, 16384>>(acorn_DFS_2_26_rom));
10291059

10301060
core->SetKeyState(BeebKey_Shift,true);
10311061

0 commit comments

Comments
 (0)