File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
platform/rustboyadvance-sdl2/src Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ fn try_load_zip(data: &[u8]) -> LoadRomResult {
56
56
) )
57
57
}
58
58
59
- pub ( super ) fn load_from_file ( path : & Path ) -> LoadRomResult {
59
+ pub fn load_from_file ( path : & Path ) -> LoadRomResult {
60
60
let bytes = read_bin_file ( path) ?;
61
61
62
62
match path. extension ( ) {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ mod rtc;
18
18
use gpio:: Gpio ;
19
19
20
20
mod builder;
21
- mod loader;
21
+ pub mod loader;
22
22
pub use builder:: GamepakBuilder ;
23
23
24
24
pub const GPIO_PORT_DATA : u32 = 0xC4 ;
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ use rustboyadvance_core::prelude::*;
26
26
27
27
use rustboyadvance_utils:: FpsCounter ;
28
28
29
+ use rustboyadvance_core:: cartridge:: loader:: { load_from_file, LoadRom } ;
30
+
29
31
const LOG_DIR : & str = ".logs" ;
30
32
31
33
fn ask_download_bios ( ) {
@@ -161,7 +163,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
161
163
let ( audio_interface, _sdl_audio_device_new) =
162
164
audio:: create_audio_player ( & sdl_context) ?;
163
165
_sdl_audio_device = _sdl_audio_device_new;
164
- let rom = opts. read_rom ( ) ?. into_boxed_slice ( ) ;
166
+ let rom = match load_from_file ( & opts. rom ) ? {
167
+ LoadRom :: Raw ( data) => data. into_boxed_slice ( ) ,
168
+ LoadRom :: Elf { data, .. } => data. into_boxed_slice ( ) ,
169
+ } ;
165
170
gba = Box :: new ( GameBoyAdvance :: from_saved_state (
166
171
& save,
167
172
bios_bin. clone ( ) ,
You can’t perform that action at this time.
0 commit comments