@@ -28,6 +28,14 @@ cd /build/src/libretro
28
28
make clean
29
29
make -j6
30
30
31
+ current restrictions:
32
+ one model
33
+ crude autostart
34
+ no drive sound
35
+ no keyboard remap (positional only)
36
+ no joystick remap
37
+ no savestate
38
+ .ssd/.dsd files only
31
39
32
40
compilation:
33
41
manage static 6502_internal.inl - probably to stay
@@ -36,7 +44,7 @@ make -j6
36
44
remove not needed source files + ifdef changes
37
45
38
46
core options
39
- autoboot on/off
47
+ autoboot on/off, combine shift with autostart file name detection
40
48
machine model - build in JSON
41
49
selectable joypad controls (azop, az/', etc.)
42
50
fully customizable joypad controls
@@ -49,7 +57,6 @@ speed / accuracy:
49
57
fake interlace - based on register?
50
58
51
59
functions:
52
- hook up reset
53
60
save state
54
61
load uef?
55
62
LED support
@@ -60,7 +67,6 @@ speed / accuracy:
60
67
drive (and relay?) sound
61
68
62
69
main QoL
63
- load game with disc input (paste?)
64
70
intelligent zoom?
65
71
keyboard layouts?
66
72
@@ -94,6 +100,9 @@ other QoL
94
100
#include " b2_libretro_keymap.h"
95
101
96
102
#define MAX_DISK_COUNT 10
103
+ #define PASTE_FRAME 200
104
+ size_t frameIndex = 0 ;
105
+ bool autoStartPaste = false ;
97
106
static struct retro_log_callback logging;
98
107
static retro_log_printf_t log_cb;
99
108
static retro_environment_t environ_cb;
@@ -151,6 +160,7 @@ BBCMicro *core = (BBCMicro *) 0;
151
160
TVOutput tv;
152
161
VideoDataUnit vdu;
153
162
SoundDataUnit sdu;
163
+ static std::shared_ptr<const std::string> COPY_BASIC;
154
164
155
165
static void fallback_log (enum retro_log_level level, const char *fmt, ...)
156
166
{
@@ -237,6 +247,21 @@ static void update_keyboard_cb(bool down, unsigned keycode,
237
247
}
238
248
}
239
249
250
+ static void create_core (BBCMicro** newcore)
251
+ {
252
+ if (*newcore)
253
+ {
254
+ delete *newcore;
255
+ *newcore = (BBCMicro *) 0 ;
256
+ log_cb (RETRO_LOG_DEBUG, " Deleting previous core\n " );
257
+ }
258
+ *newcore = new BBCMicro (&BBC_MICRO_TYPE_B,&DISC_INTERFACE_ACORN_1770,BBCMicroParasiteType_None,{},nullptr ,0 ,nullptr ,{0 });
259
+ (*newcore)->SetOSROM ( std::make_shared<std::array<unsigned char , 16384 >>(OS12_ROM));
260
+ (*newcore)->SetSidewaysROM (15 , std::make_shared<std::array<unsigned char , 16384 >>(BASIC2_ROM));
261
+ (*newcore)->SetSidewaysROM (14 , std::make_shared<std::array<unsigned char , 16384 >>(acorn_DFS_2_26_rom));
262
+ log_cb (RETRO_LOG_DEBUG, " New core created\n " );
263
+ }
264
+
240
265
static void check_variables (void )
241
266
{
242
267
/* struct retro_variable var =
@@ -584,11 +609,12 @@ void retro_init(void)
584
609
log_cb (RETRO_LOG_DEBUG, " Creating core...\n " );
585
610
// core = new BBCMicro(&BBC_MICRO_TYPE_B,&DISC_INTERFACE_ACORN_1770,BBCMicroParasiteType_None,{},nullptr,0,nullptr,{0});
586
611
// core = new BBCMicro(&BBC_MICRO_TYPE_B,nullptr,BBCMicroParasiteType_None,{},nullptr,0,nullptr,{0});
587
- core = new BBCMicro (&BBC_MICRO_TYPE_B,&DISC_INTERFACE_ACORN_1770,BBCMicroParasiteType_None,{},nullptr ,0 ,nullptr ,{0 });
612
+ create_core (&core);
613
+ /* core = new BBCMicro(&BBC_MICRO_TYPE_B,&DISC_INTERFACE_ACORN_1770,BBCMicroParasiteType_None,{},nullptr,0,nullptr,{0});
588
614
589
615
core->SetOSROM( std::make_shared<std::array<unsigned char, 16384>>(OS12_ROM));
590
616
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));
617
+ core->SetSidewaysROM(14, std::make_shared<std::array<unsigned char, 16384>>(acorn_DFS_2_26_rom));*/
592
618
593
619
// tv = TVOutput();
594
620
@@ -597,7 +623,6 @@ void retro_init(void)
597
623
core->Update (&vdu,&sdu);
598
624
updateCount++;
599
625
600
-
601
626
/* core->start();
602
627
core->change_resolution(core->currWidth,core->currHeight,environ_cb);*/
603
628
}
@@ -690,9 +715,8 @@ void retro_set_video_refresh(retro_video_refresh_t cb)
690
715
691
716
void retro_reset (void )
692
717
{
693
- // printf("retro_reset \n");
694
-
695
- /* if(vmThread) vmThread->reset(true);*/
718
+ log_cb (RETRO_LOG_INFO, " Machine hard reset\n " );
719
+ create_core (&core);
696
720
}
697
721
698
722
static void update_input (void )
@@ -769,6 +793,7 @@ static void audio_callback_batch(void)
769
793
770
794
void retro_run (void )
771
795
{
796
+ frameIndex++;
772
797
// printf("retro_run \n");
773
798
774
799
bool updated = false ;
@@ -1004,6 +1029,15 @@ void retro_run(void)
1004
1029
/* LED interface */
1005
1030
/* if (led_state_cb)
1006
1031
update_led_interface();*/
1032
+ if (frameIndex == PASTE_FRAME)
1033
+ {
1034
+ if (autoStartPaste) {
1035
+ core->StartPaste (COPY_BASIC);
1036
+ autoStartPaste = false ;
1037
+ } else {
1038
+ core->SetKeyState (BeebKey_Shift,false );
1039
+ }
1040
+ }
1007
1041
}
1008
1042
1009
1043
bool header_match (const char * buf1, const unsigned char * buf2, size_t length)
@@ -1045,22 +1079,39 @@ bool retro_load_game(const struct retro_game_info *info)
1045
1079
1046
1080
if (info != nullptr )
1047
1081
{
1048
- if (core)
1082
+ log_cb (RETRO_LOG_INFO, " Loading game: %s \n " ,info->path );
1083
+ create_core (&core);
1084
+ /* if (core)
1049
1085
{
1050
1086
delete core;
1051
1087
core = (BBCMicro *) 0;
1052
1088
}
1053
- log_cb (RETRO_LOG_INFO, " Loading game: %s \n " ,info->path );
1054
1089
1055
1090
core = new BBCMicro(&BBC_MICRO_TYPE_B,&DISC_INTERFACE_ACORN_1770,BBCMicroParasiteType_None,{},nullptr,0,nullptr,{0});
1056
1091
core->SetOSROM( std::make_shared<std::array<unsigned char, 16384>>(OS12_ROM));
1057
1092
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));
1093
+ core->SetSidewaysROM(14, std::make_shared<std::array<unsigned char, 16384>>(acorn_DFS_2_26_rom));*/
1059
1094
1060
- core->SetKeyState (BeebKey_Shift,true );
1061
1095
1062
1096
std::string path = info->path ;
1063
1097
core->SetDiscImage (0 , DirectDiscImage::CreateForFile (path, nullptr ));
1098
+
1099
+ // Autoboot: if there is [SOMETHING] notice in the filename, use it
1100
+ // otherwise press Shift and hope for autoboot
1101
+ std::string filename (info->path );
1102
+ std::string autostartName;
1103
+ size_t ridx = filename.rfind (' [' );
1104
+ size_t lidx = filename.rfind (' ]' );
1105
+ if (ridx != std::string::npos)
1106
+ {
1107
+ autostartName = " CHAIN\" " +filename.substr (ridx+1 ,lidx-ridx-1 )+" \"\r " ;
1108
+ log_cb (RETRO_LOG_DEBUG, " Autostart name: %s \n " ,autostartName.c_str ());
1109
+ COPY_BASIC = std::make_shared<const std::string>(autostartName.c_str ());
1110
+ autoStartPaste = true ;
1111
+ }
1112
+ else
1113
+ core->SetKeyState (BeebKey_Shift,true );
1114
+
1064
1115
}
1065
1116
1066
1117
/*
0 commit comments