mirror of
https://github.com/mist-devel/mist-firmware.git
synced 2026-04-27 12:49:41 +00:00
minimig: Make Kickstart 1.2/1.3 honour changes of memory configuration
This commit is contained in:
9
config.c
9
config.c
@@ -17,6 +17,7 @@
|
||||
#include "config.h"
|
||||
#include "user_io.h"
|
||||
#include "usb/usb.h"
|
||||
#include "minimig_cfg.h"
|
||||
|
||||
configTYPE config;
|
||||
fileTYPE file;
|
||||
@@ -251,7 +252,7 @@ unsigned char ConfigurationExists(char *filename)
|
||||
|
||||
|
||||
//// LoadConfiguration() ////
|
||||
unsigned char LoadConfiguration(char *filename)
|
||||
unsigned char LoadConfiguration(char *filename, int printconfig)
|
||||
{
|
||||
static const char config_id[] = "MNMGCFG0";
|
||||
char updatekickstart=0;
|
||||
@@ -316,11 +317,11 @@ unsigned char LoadConfiguration(char *filename)
|
||||
}
|
||||
|
||||
// print config to boot screen
|
||||
if (minimig_v2()) {
|
||||
char cfg_str[41];
|
||||
if (minimig_v2() && printconfig) {
|
||||
char cfg_str[81];
|
||||
siprintf(cfg_str, "CPU: %s", config_cpu_msg[config.cpu & 0x03]); BootPrintEx(cfg_str);
|
||||
siprintf(cfg_str, "Chipset: %s", config_chipset_msg [(config.chipset >> 2) & (minimig_v1()?3:7)]); BootPrintEx(cfg_str);
|
||||
siprintf(cfg_str, "Memory: CHIP: %s FAST: %s SLOW: %s", config_memory_chip_msg[(config.memory >> 0) & 0x03], config_memory_fast_msg[(config.memory >> 4) & 0x03], config_memory_slow_msg[(config.memory >> 2) & 0x03]); BootPrintEx(cfg_str);
|
||||
siprintf(cfg_str, "Memory: CHIP: %s FAST: %s SLOW: %s%s", config_memory_chip_msg[(config.memory >> 0) & 0x03], config_memory_fast_msg[(config.memory >> 4) & 0x03], config_memory_slow_msg[(config.memory >> 2) & 0x03], minimig_cfg.kick1x_memory_detection_patch ? " [Kick 1.x patch enabled]" : ""); BootPrintEx(cfg_str);
|
||||
}
|
||||
|
||||
// wait up to 3 seconds for keyboard to appear. If it appears wait another
|
||||
|
||||
2
config.h
2
config.h
@@ -46,7 +46,7 @@ extern char DebugMode;
|
||||
char UploadKickstart(char *name);
|
||||
char UploadActionReplay();
|
||||
void SetConfigurationFilename(int config); // Set configuration filename by slot number
|
||||
unsigned char LoadConfiguration(char *filename); // Can supply NULL to use filename previously set by slot number
|
||||
unsigned char LoadConfiguration(char *filename, int printconfig); // Can supply NULL to use filename previously set by slot number
|
||||
unsigned char SaveConfiguration(char *filename); // Can supply NULL to use filename previously set by slot number
|
||||
unsigned char ConfigurationExists(char *filename);
|
||||
void ApplyConfiguration(char reloadkickstart);
|
||||
|
||||
50
fpga.c
50
fpga.c
@@ -483,6 +483,37 @@ void SendFileEncrypted(RAFile *file,unsigned char *key,int keysize)
|
||||
iprintf("]\r");
|
||||
}
|
||||
|
||||
char kick1xfoundstr[] = "Kickstart v1.x found\n";
|
||||
const char applymemdetectionpatchstr[] = "Applying Kickstart 1.x memory detection patch\n";
|
||||
|
||||
const char *kickfoundstr = NULL, *applypatchstr = NULL;
|
||||
|
||||
void PatchKick1xMemoryDetection() {
|
||||
int applypatch = 0;
|
||||
|
||||
if (!strncmp(sector_buffer + 0x18, "exec 33.192 (8 Oct 1986)", 24)) {
|
||||
kick1xfoundstr[13] = '2';
|
||||
kickfoundstr = kick1xfoundstr;
|
||||
goto applypatch;
|
||||
}
|
||||
if (!strncmp(sector_buffer + 0x18, "exec 34.2 (28 Oct 1987)", 23)) {
|
||||
kick1xfoundstr[13] = '3';
|
||||
kickfoundstr = kick1xfoundstr;
|
||||
goto applypatch;
|
||||
}
|
||||
|
||||
goto out;
|
||||
|
||||
applypatch:
|
||||
if ((sector_buffer[0x154] == 0x66) && (sector_buffer[0x155] == 0x78)) {
|
||||
applypatchstr = applymemdetectionpatchstr;
|
||||
sector_buffer[0x154] = 0x60;
|
||||
}
|
||||
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
// SendFileV2 (for minimig_v2)
|
||||
void SendFileV2(RAFile* file, unsigned char* key, int keysize, int address, int size)
|
||||
{
|
||||
@@ -504,6 +535,14 @@ void SendFileV2(RAFile* file, unsigned char* key, int keysize, int address, int
|
||||
if(keyidx >= keysize) keyidx -= keysize;
|
||||
}
|
||||
}
|
||||
|
||||
// patch kickstart 1.x to force memory detection every time the AMIGA is reset
|
||||
if (minimig_cfg.kick1x_memory_detection_patch && (i == 0 || i == 512)) {
|
||||
kickfoundstr = NULL;
|
||||
applypatchstr = NULL;
|
||||
PatchKick1xMemoryDetection();
|
||||
}
|
||||
|
||||
EnableOsd();
|
||||
unsigned int adr = address + i*512;
|
||||
SPI(OSD_CMD_WR);
|
||||
@@ -525,6 +564,13 @@ void SendFileV2(RAFile* file, unsigned char* key, int keysize, int address, int
|
||||
DisableOsd();
|
||||
}
|
||||
iprintf("]\r");
|
||||
|
||||
if (kickfoundstr) {
|
||||
iprintf(kickfoundstr);
|
||||
}
|
||||
if (applypatchstr) {
|
||||
iprintf(applypatchstr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -933,8 +979,8 @@ void fpga_init(char *name, unsigned long currentdirectory) {
|
||||
|
||||
config.kickstart.name[0]=0;
|
||||
SetConfigurationFilename(0); // Use default config
|
||||
LoadConfiguration(0); // Use slot-based config filename
|
||||
|
||||
LoadConfiguration(0, 1); // Use slot-based config filename
|
||||
|
||||
ChangeDirectory(OldDirectory);
|
||||
} // end of minimig setup
|
||||
|
||||
|
||||
2
menu.c
2
menu.c
@@ -2232,7 +2232,7 @@ void HandleUI(void)
|
||||
{
|
||||
OsdDisable();
|
||||
SetConfigurationFilename(menusub);
|
||||
LoadConfiguration(NULL);
|
||||
LoadConfiguration(NULL, 0);
|
||||
// OsdReset(RESET_NORMAL);
|
||||
menustate = MENU_NONE1;
|
||||
}
|
||||
|
||||
18
minimig_cfg.h
Normal file
18
minimig_cfg.h
Normal file
@@ -0,0 +1,18 @@
|
||||
// minimig_cfg.h
|
||||
|
||||
|
||||
#ifndef __MINIMIG_CFG_H__
|
||||
#define __MINIMIG_CFG_H__
|
||||
|
||||
|
||||
//// type definitions ////
|
||||
typedef struct {
|
||||
uint8_t kick1x_memory_detection_patch;
|
||||
} minimig_cfg_t;
|
||||
|
||||
|
||||
//// global variables ////
|
||||
extern minimig_cfg_t minimig_cfg;
|
||||
|
||||
|
||||
#endif // __MINIMIG_CFG_H__
|
||||
17
mist_cfg.c
17
mist_cfg.c
@@ -18,6 +18,8 @@ void mist_ini_parse()
|
||||
virtual_joystick_remap_init();
|
||||
joy_key_map_init();
|
||||
memset(&mist_cfg, 0, sizeof(mist_cfg));
|
||||
memset(&minimig_cfg, 0, sizeof(minimig_cfg));
|
||||
minimig_cfg.kick1x_memory_detection_patch = 1;
|
||||
ini_parse(&mist_ini_cfg);
|
||||
}
|
||||
|
||||
@@ -40,13 +42,19 @@ mist_cfg_t mist_cfg = {
|
||||
.led_animation = 0
|
||||
};
|
||||
|
||||
minimig_cfg_t minimig_cfg = {
|
||||
.kick1x_memory_detection_patch = 0
|
||||
};
|
||||
|
||||
// mist ini sections
|
||||
const ini_section_t mist_ini_sections[] = {
|
||||
{1, "MIST"}
|
||||
{1, "MIST"},
|
||||
{2, "MINIMIG_CONFIG"}
|
||||
};
|
||||
|
||||
// mist ini vars
|
||||
const ini_var_t mist_ini_vars[] = {
|
||||
// [MIST] or [<core name>]
|
||||
{"LED_ANIMATION", (void*)(&(mist_cfg.led_animation)), UINT8, 0, 1, 1},
|
||||
{"YPBPR", (void*)(&(mist_cfg.ypbpr)), UINT8, 0, 1, 1},
|
||||
{"KEEP_VIDEO_MODE", (void*)(&(mist_cfg.keep_video_mode)), UINT8, 0, 1, 1},
|
||||
@@ -64,8 +72,10 @@ const ini_var_t mist_ini_vars[] = {
|
||||
{"HID_BUTTON_REMAP", (void*)hid_joystick_button_remap, CUSTOM_HANDLER, 0, 0, 1},
|
||||
{"JOYSTICK_REMAP", (void*)virtual_joystick_remap, CUSTOM_HANDLER, 0, 0, 1},
|
||||
{"JOY_KEY_MAP", (void*)joystick_key_map, CUSTOM_HANDLER, 0, 0, 1},
|
||||
{"ROM", (void*)ini_rom_upload, CUSTOM_HANDLER, 0, 0, 1}
|
||||
};
|
||||
{"ROM", (void*)ini_rom_upload, CUSTOM_HANDLER, 0, 0, 1},
|
||||
// [MINIMIG_CONFIG]
|
||||
{"KICK1X_MEMORY_DETECTION_PATCH", (void*)(&(minimig_cfg.kick1x_memory_detection_patch)), UINT8, 0, 1, 2}
|
||||
};
|
||||
|
||||
// mist ini config
|
||||
const ini_cfg_t mist_ini_cfg = {
|
||||
@@ -75,4 +85,3 @@ const ini_cfg_t mist_ini_cfg = {
|
||||
(int)(sizeof(mist_ini_sections) / sizeof(ini_section_t)),
|
||||
(int)(sizeof(mist_ini_vars) / sizeof(ini_var_t))
|
||||
};
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
//// includes ////
|
||||
#include <inttypes.h>
|
||||
#include "ini_parser.h"
|
||||
#include "minimig_cfg.h"
|
||||
|
||||
|
||||
//// type definitions ////
|
||||
@@ -39,4 +40,3 @@ extern mist_cfg_t mist_cfg;
|
||||
|
||||
|
||||
#endif // __MIST_CFG_H__
|
||||
|
||||
|
||||
Reference in New Issue
Block a user