Skip to content

Commit feafcf7

Browse files
authored
Merge pull request #32 from fhoedemakers/retroJam
Aligned with changes for retroJam
2 parents d583016 + f959c8f commit feafcf7

11 files changed

Lines changed: 50 additions & 51 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,13 @@
77

88
[See setup section in in Pico-infoNesPlus readme how to install and wire up](https://github.com/fhoedemakers/pico-infonesPlus#pico-setup)
99

10-
# v0.23 Release Notes
11-
12-
- Implemented savestates [#140](https://github.com/fhoedemakers/pico-infonesPlus/issues/140)
13-
- Up to 5 manual save state slots per game, accessible via the in-game menu (SELECT + START).
14-
- In-game quick savestate Save/Restore via (START + DOWN) and (START + UP).
15-
- Auto Save can be enabled per game, which allows to save the current state when exiting to the menu. When the game is launched, player can choose to restore that state.
16-
17-
When loading a state, the game mostly resumes paused. Press START to continue playing.
18-
19-
- Added support for [Murmulator M1 and M2 boards](https://murmulator.ru). [@javavi](https://github.com/javavi) [#150](https://github.com/fhoedemakers/pico-infonesPlus/issues/150)
20-
- M1: RP2040/RP2350 **Note**: Untested
21-
- M2: RP2350 only **Note**: Untested
22-
- **Fruit Jam only**: Add volume controls to settings menu. Can also be changed in-game via (START + LEFT/RIGHT). Note that too high volume levels may cause distortion. (Ext speaker, advised 16 db max, internal advised 18 dB max). Latest metadata package includes a sample.wav file to test the volume level.
23-
- Updated SMSPlusMetaData.zip: Added **sample.wav**. This sample will be played when using the Fruit Jam volume control in the settings menu. Note when **/soundrecorder.wav** is found, this file will be played in stead.
24-
- **RP2350 only**: Updated the menu to also list .wav audio files.
25-
- **RP2350 Only**: Added basic wav audio playback from within the menu. Press BUTTON2 or START to play the wav file. Tested with https://lonepeakmusic.itch.io/retro-midi-music-pack-1 The wav file must have the following specs:
26-
- 16/24 bit PCM wav files only. (24 bit files are downsampled to 16 bit)
27-
- 2ch stereo only.
28-
- Sample rate supported: 44100.
29-
- **RP2350 with PSRAM only**: Record about 30 seconds of audio by pressing START to pause the game and then START + BUTTON1. Audio is recorded to **/soundrecorder.wav** on the SD-card.
10+
# v0.24 Release Notes
3011

3112
## Fixes
3213

33-
- Fruit Jam audio fixes.
34-
- Settings changed by in-game button combos are saved when exiting to menu.
35-
- DVI audio volume was somewhat too low, fixed. [#146](https://github.com/fhoedemakers/pico-infonesPlus/issues/146)
36-
- Workaround for memory issues on RP2040 boards: When exiting from a game, the board will be rebooted to free up memory.
14+
- Emulator buffers are now allocated dynmically.
15+
- Pimoroni Pico DV Demo base: Settings are accessible from within the menu again.
16+
- ENding a game will now go back to the menu instead of rebooting the board.
3717

3818
# previous changes
3919

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if (NOT USE_HSTX)
2121
endif()
2222
include("pico_shared/BoardConfigs.cmake")
2323
if (NOT PICO_BOARD )
24-
set(PICO_BOARD pico2 CACHE STRING "Board type")
24+
set(PICO_BOARD pico CACHE STRING "Board type")
2525
message("PICO_BOARD not set, using default: ${PICO_BOARD}")
2626
endif()
2727
add_definitions( -DNDEBUG )

HISTORY.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# History of changes
22

3+
# v0.23 Release Notes
4+
5+
- Implemented savestates [#140](https://github.com/fhoedemakers/pico-infonesPlus/issues/140)
6+
- Up to 5 manual save state slots per game, accessible via the in-game menu (SELECT + START).
7+
- In-game quick savestate Save/Restore via (START + DOWN) and (START + UP).
8+
- Auto Save can be enabled per game, which allows to save the current state when exiting to the menu. When the game is launched, player can choose to restore that state.
9+
10+
When loading a state, the game mostly resumes paused. Press START to continue playing.
11+
12+
- Added support for [Murmulator M1 and M2 boards](https://murmulator.ru). [@javavi](https://github.com/javavi) [#150](https://github.com/fhoedemakers/pico-infonesPlus/issues/150)
13+
- M1: RP2040/RP2350 **Note**: Untested
14+
- M2: RP2350 only **Note**: Untested
15+
- **Fruit Jam only**: Add volume controls to settings menu. Can also be changed in-game via (START + LEFT/RIGHT). Note that too high volume levels may cause distortion. (Ext speaker, advised 16 db max, internal advised 18 dB max). Latest metadata package includes a sample.wav file to test the volume level.
16+
- Updated SMSPlusMetaData.zip: Added **sample.wav**. This sample will be played when using the Fruit Jam volume control in the settings menu. Note when **/soundrecorder.wav** is found, this file will be played in stead.
17+
- **RP2350 only**: Updated the menu to also list .wav audio files.
18+
- **RP2350 Only**: Added basic wav audio playback from within the menu. Press BUTTON2 or START to play the wav file. Tested with https://lonepeakmusic.itch.io/retro-midi-music-pack-1 The wav file must have the following specs:
19+
- 16/24 bit PCM wav files only. (24 bit files are downsampled to 16 bit)
20+
- 2ch stereo only.
21+
- Sample rate supported: 44100.
22+
- **RP2350 with PSRAM only**: Record about 30 seconds of audio by pressing START to pause the game and then START + BUTTON1. Audio is recorded to **/soundrecorder.wav** on the SD-card.
23+
24+
## Fixes
25+
26+
- Fruit Jam audio fixes.
27+
- Settings changed by in-game button combos are saved when exiting to menu.
28+
- DVI audio volume was somewhat too low, fixed. [#146](https://github.com/fhoedemakers/pico-infonesPlus/issues/146)
29+
- Workaround for memory issues on RP2040 boards: When exiting from a game, the board will be rebooted to free up memory.
30+
331
# v0.22 Release Notes
432

533
- Settings are saved to /settings_sms.dat instead of /settings.dat. This allows to have separate settings files for different emulators (e.g. pico-infonesPlus and pico-peanutGB etc.).

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ Gamepad buttons:
135135
- START: Show metadata and box art (when available).
136136
- SELECT: Opens a setting menu. Here you can change settings like screen mode, scanlines, framerate display, menu colors and other board specific settings. Settings can also be changed in-game by pressing some button combinations as explained below. The settings menu can also be opened in-game.
137137

138-
>[!NOTE]
139-
>On the Pimoroni Pico DV Demo Base with a Raspberry Pi Pico (RP2040), the settings menu can only be accessed during gameplay. Accessing the settings from the main menu is disabled due to occasional crashes with this specific hardware configuration.
140-
141138
## Emulator (in game)
142139
Gamepad buttons:
143140
- SELECT + START, Xbox button: opens the settings menu. From there, you can:

main.cpp

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static uint32_t CPUFreqKHz = EMULATOR_CLOCKFREQ_KHZ;
5656
// Visibility configuration for options menu (NES specific)
5757
// 1 = show option line, 0 = hide.
5858
// Order must match enum in menu_options.h
59-
const int8_t g_settings_visibility[MOPT_COUNT] = {
59+
const int8_t g_settings_visibility_sms[MOPT_COUNT] = {
6060
0, // Exit Game, or back to menu. Always visible when in-game.
6161
0, // Save / Restore State
6262
!HSTX, // Screen Mode (only when not HSTX)
@@ -75,7 +75,7 @@ const int8_t g_settings_visibility[MOPT_COUNT] = {
7575
0, // Rapid Fire on A
7676
0, // Rapid Fire on B
7777
};
78-
const uint8_t g_available_screen_modes[] = {
78+
const uint8_t g_available_screen_modes_sms[] = {
7979
#if PICO_RP2350
8080
0, // SCANLINE_8_7, Does not work well with borders
8181
#else
@@ -1108,6 +1108,8 @@ int main()
11081108
scaleMode8_7_ = Frens::applyScreenMode(settings.screenMode);
11091109
#endif
11101110
bool showSplash = true;
1111+
g_settings_visibility = g_settings_visibility_sms;
1112+
g_available_screen_modes = g_available_screen_modes_sms;
11111113
while (true)
11121114
{
11131115
#if 1
@@ -1192,25 +1194,12 @@ int main()
11921194
system_reset();
11931195
printf("Starting game\n");
11941196
process();
1195-
#if PICO_RP2350
11961197
system_shutdown();
11971198
selectedRom[0] = 0;
11981199
showSplash = false;
11991200
#if ENABLE_VU_METER
12001201
turnOffAllLeds();
12011202
#endif
1202-
#else
1203-
// RP2040: to avoid possible out of memory errors after reset, reboot the system
1204-
printf("Rebooting...\n");
1205-
f_unlink(ROMINFOFILE); // remove rom info file to prevent loading same rom again at startup
1206-
watchdog_enable(1, 1);
1207-
while (1)
1208-
{
1209-
tight_loop_contents();
1210-
// printf("Waiting for reboot...\n");
1211-
};
1212-
#endif
1213-
12141203
}
12151204

12161205
return 0;

smsplus/loadrom.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ typedef struct
9595

9696
// return 1;
9797
// }
98+
void *frens_f_malloc(size_t size);
9899
int load_rom(uintptr_t addr, int size, bool isGameGear)
99100
{
100101
uint8_t *start = (uint8_t *)addr;
@@ -105,7 +106,8 @@ int load_rom(uintptr_t addr, int size, bool isGameGear)
105106
}
106107
sms.use_fm = 0;
107108
sms.country = TYPE_OVERSEAS;
108-
sms.sram = sram;
109+
sms.ram = (uint8 *)frens_f_malloc(RAMSIZEBYTES);
110+
sms.sram = (uint8 *)frens_f_malloc(SRAMSIZEBYTES);
109111
sms.dummy = smsBufferLine;
110112
bitmap.data = smsBufferLine;
111113
bitmap.width = BMP_WIDTH;

smsplus/sms.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void sms_init(void) {
8080
void sms_reset(void) {
8181
/* Clear SMS context */
8282

83-
__builtin_memset(sram, 0, SRAMSIZEBYTES);
83+
__builtin_memset(sms.sram, 0, SRAMSIZEBYTES);
8484
__builtin_memset(sms.ram, 0, RAMSIZEBYTES);
8585

8686
sms.paused = sms.save = sms.port_3F = sms.port_F2 = sms.irq = 0x00;

smsplus/sms.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ static int palette444[32];
2222
#define RAMSIZE 0x2000
2323
#define RAMSIZEBYTES (0x2000 * sizeof(uint8))
2424

25-
static uint8 sram[SRAMSIZE];
25+
//static uint8 sram[SRAMSIZE];
2626
/* SMS context */
2727
typedef struct {
2828
uint8 *dummy; //JMD: Point this into outher space plz.
29-
uint8 ram[RAMSIZE];
29+
uint8 *ram; // [RAMSIZE];
3030
// uint8 sram[0x8000];
3131
uint8 *sram;
3232
uint8 fcr[4];

smsplus/system.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void system_init(int rate) {
5555
render_init();
5656

5757
/* Enable sound emulation if the sample rate was specified */
58-
audio_init(rate);
58+
system_audio_init(rate);
5959

6060
/* Don't save SRAM by default */
6161
sms.save = 0;
@@ -64,7 +64,7 @@ void system_init(int rate) {
6464
__builtin_memset(&input, 0, sizeof(t_input));
6565
}
6666

67-
void audio_init(int rate) {
67+
void system_audio_init(int rate) {
6868
/* Clear sound context */
6969
__builtin_memset(&snd, 0, sizeof(t_snd));
7070

@@ -119,6 +119,9 @@ void system_shutdown(void)
119119
frens_f_free(cacheStoreUsed);
120120
frens_f_free(cacheStore);
121121
frens_f_free(cachePtr);
122+
frens_f_free(sms.sram);
123+
frens_f_free(sms.ram);
124+
122125
if (snd.enabled)
123126
{
124127
// OPLL_delete(opll);

0 commit comments

Comments
 (0)