mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
random fixes (root path and mmap svp tcache)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@714 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
093b8a420e
commit
27701801c1
7 changed files with 58 additions and 43 deletions
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "../../pico_int.h"
|
#include "../../pico_int.h"
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
#ifdef __linux__
|
#if defined(__linux__) && defined(ARM)
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ static int PicoSVPDma(unsigned int source, int len, unsigned short **srcp, unsig
|
||||||
|
|
||||||
void PicoSVPInit(void)
|
void PicoSVPInit(void)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#if defined(__linux__) && defined(ARM)
|
||||||
int ret;
|
int ret;
|
||||||
ret = munmap(tcache, SSP_DRC_SIZE);
|
ret = munmap(tcache, SSP_DRC_SIZE);
|
||||||
printf("munmap tcache: %i\n", ret);
|
printf("munmap tcache: %i\n", ret);
|
||||||
|
@ -110,7 +110,7 @@ void PicoSVPInit(void)
|
||||||
|
|
||||||
static void PicoSVPShutdown(void)
|
static void PicoSVPShutdown(void)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#if defined(__linux__) && defined(ARM)
|
||||||
// also unmap tcache
|
// also unmap tcache
|
||||||
PicoSVPInit();
|
PicoSVPInit();
|
||||||
#endif
|
#endif
|
||||||
|
@ -135,7 +135,7 @@ void PicoSVPStartup(void)
|
||||||
svp = (void *) ((char *)tmp + 0x200000);
|
svp = (void *) ((char *)tmp + 0x200000);
|
||||||
memset(svp, 0, sizeof(*svp));
|
memset(svp, 0, sizeof(*svp));
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined(__linux__) && defined(ARM)
|
||||||
tmp = mmap(tcache, SSP_DRC_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
|
tmp = mmap(tcache, SSP_DRC_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
|
||||||
printf("mmap tcache: %p, asked %p\n", tmp, tcache);
|
printf("mmap tcache: %p, asked %p\n", tmp, tcache);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -112,8 +112,7 @@ static int find_bios(int region, char **bios_file)
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
plat_get_root_dir(bios_path, sizeof(bios_path));
|
emu_make_path(bios_path, files[i], sizeof(bios_path) - 4);
|
||||||
strcat(bios_path, files[i]);
|
|
||||||
strcat(bios_path, ".bin");
|
strcat(bios_path, ".bin");
|
||||||
f = fopen(bios_path, "rb");
|
f = fopen(bios_path, "rb");
|
||||||
if (f) break;
|
if (f) break;
|
||||||
|
@ -533,18 +532,29 @@ static void romfname_ext(char *dst, const char *prefix, const char *ext)
|
||||||
if (ext) strcat(dst, ext);
|
if (ext) strcat(dst, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void make_config_cfg(char *cfg)
|
void emu_make_path(char *buff, const char *end, int size)
|
||||||
{
|
{
|
||||||
int len;
|
int pos, end_len;
|
||||||
len = plat_get_root_dir(cfg, 512);
|
|
||||||
strncpy(cfg + len, PicoConfigFile, 512-6-1-len);
|
end_len = strlen(end);
|
||||||
|
pos = plat_get_root_dir(buff, size);
|
||||||
|
strncpy(buff + pos, end, size - pos);
|
||||||
|
buff[size - 1] = 0;
|
||||||
|
if (pos + end_len > size - 1)
|
||||||
|
lprintf("Warning: path truncated: %s\n", buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void make_config_cfg(char *cfg_buff_512)
|
||||||
|
{
|
||||||
|
emu_make_path(cfg_buff_512, PicoConfigFile, 512-6);
|
||||||
if (config_slot != 0)
|
if (config_slot != 0)
|
||||||
{
|
{
|
||||||
char *p = strrchr(cfg, '.');
|
char *p = strrchr(cfg_buff_512, '.');
|
||||||
if (p == NULL) p = cfg + strlen(cfg);
|
if (p == NULL)
|
||||||
|
p = cfg_buff_512 + strlen(cfg_buff_512);
|
||||||
sprintf(p, ".%i.cfg", config_slot);
|
sprintf(p, ".%i.cfg", config_slot);
|
||||||
}
|
}
|
||||||
cfg[511] = 0;
|
cfg_buff_512[511] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void emu_setDefaultConfig(void)
|
static void emu_setDefaultConfig(void)
|
||||||
|
@ -650,16 +660,6 @@ int emu_write_config(int is_game)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void emu_writelrom(void)
|
|
||||||
{
|
|
||||||
char cfg[512];
|
|
||||||
make_config_cfg(cfg);
|
|
||||||
config_writelrom(cfg);
|
|
||||||
#ifndef NO_SYNC
|
|
||||||
sync();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* always using built-in font */
|
/* always using built-in font */
|
||||||
|
|
||||||
#define mk_text_out(name, type, val) \
|
#define mk_text_out(name, type, val) \
|
||||||
|
@ -1152,14 +1152,17 @@ static void mkdir_path(char *path_with_reserve, int pos, const char *name)
|
||||||
|
|
||||||
void emu_init(void)
|
void emu_init(void)
|
||||||
{
|
{
|
||||||
char dir[256];
|
char path[512];
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
/* make dirs for saves */
|
/* make dirs for saves */
|
||||||
pos = plat_get_root_dir(dir, sizeof(dir) - 4);
|
pos = plat_get_root_dir(path, sizeof(path) - 4);
|
||||||
mkdir_path(dir, pos, "mds");
|
mkdir_path(path, pos, "mds");
|
||||||
mkdir_path(dir, pos, "srm");
|
mkdir_path(path, pos, "srm");
|
||||||
mkdir_path(dir, pos, "brm");
|
mkdir_path(path, pos, "brm");
|
||||||
|
|
||||||
|
make_config_cfg(path);
|
||||||
|
config_readlrom(path);
|
||||||
|
|
||||||
PicoInit();
|
PicoInit();
|
||||||
PicoMessage = plat_status_msg_busy_next;
|
PicoMessage = plat_status_msg_busy_next;
|
||||||
|
@ -1175,8 +1178,14 @@ void emu_finish(void)
|
||||||
SRam.changed = 0;
|
SRam.changed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(currentConfig.EmuOpt & EOPT_NO_AUTOSVCFG))
|
if (!(currentConfig.EmuOpt & EOPT_NO_AUTOSVCFG)) {
|
||||||
emu_writelrom();
|
char cfg[512];
|
||||||
|
make_config_cfg(cfg);
|
||||||
|
config_writelrom(cfg);
|
||||||
|
#ifndef NO_SYNC
|
||||||
|
sync();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
PicoExit();
|
PicoExit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,12 +105,12 @@ void emu_reset_game(void);
|
||||||
|
|
||||||
int emu_read_config(int game, int no_defaults);
|
int emu_read_config(int game, int no_defaults);
|
||||||
int emu_write_config(int game);
|
int emu_write_config(int game);
|
||||||
void emu_writelrom(void);
|
|
||||||
|
|
||||||
char *emu_get_save_fname(int load, int is_sram, int slot);
|
char *emu_get_save_fname(int load, int is_sram, int slot);
|
||||||
int emu_check_save_file(int slot);
|
int emu_check_save_file(int slot);
|
||||||
void emu_setSaveStateCbs(int gz);
|
void emu_setSaveStateCbs(int gz);
|
||||||
|
|
||||||
|
void emu_make_path(char *buff, const char *end, int size);
|
||||||
void emu_update_input(void);
|
void emu_update_input(void);
|
||||||
void emu_textOut8 (int x, int y, const char *text);
|
void emu_textOut8 (int x, int y, const char *text);
|
||||||
void emu_textOut16(int x, int y, const char *text);
|
void emu_textOut16(int x, int y, const char *text);
|
||||||
|
|
|
@ -262,14 +262,17 @@ void menu_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// load custom font and selector (stored as 1st symbol in font table)
|
// load custom font and selector (stored as 1st symbol in font table)
|
||||||
readpng(menu_font_data, "skin/font.png", READPNG_FONT);
|
emu_make_path(buff, "skin/font.png", sizeof(buff));
|
||||||
|
readpng(menu_font_data, buff, READPNG_FONT);
|
||||||
// default selector symbol is '>'
|
// default selector symbol is '>'
|
||||||
memcpy(menu_font_data, menu_font_data + ((int)'>') * me_mfont_w * me_mfont_h / 2,
|
memcpy(menu_font_data, menu_font_data + ((int)'>') * me_mfont_w * me_mfont_h / 2,
|
||||||
me_mfont_w * me_mfont_h / 2);
|
me_mfont_w * me_mfont_h / 2);
|
||||||
readpng(menu_font_data, "skin/selector.png", READPNG_SELECTOR);
|
emu_make_path(buff, "skin/selector.png", sizeof(buff));
|
||||||
|
readpng(menu_font_data, buff, READPNG_SELECTOR);
|
||||||
|
|
||||||
// load custom colors
|
// load custom colors
|
||||||
f = fopen("skin/skin.txt", "r");
|
emu_make_path(buff, "skin/skin.txt", sizeof(buff));
|
||||||
|
f = fopen(buff, "r");
|
||||||
if (f != NULL)
|
if (f != NULL)
|
||||||
{
|
{
|
||||||
lprintf("found skin.txt\n");
|
lprintf("found skin.txt\n");
|
||||||
|
|
|
@ -295,15 +295,10 @@ void YM2612Init_940(int baseclock, int rate)
|
||||||
{
|
{
|
||||||
unsigned char ucData[1024];
|
unsigned char ucData[1024];
|
||||||
int nRead, i, nLen = 0;
|
int nRead, i, nLen = 0;
|
||||||
char binpath[1024];
|
char binpath[512];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
strncpy(binpath, g_argv[0], 1023);
|
emu_make_path(binpath, CODE940_FILE, sizeof(binpath));
|
||||||
binpath[1023] = 0;
|
|
||||||
for (i = strlen(binpath); i > 0; i--)
|
|
||||||
if (binpath[i] == '/') { binpath[i] = 0; break; }
|
|
||||||
strcat(binpath, "/" CODE940_FILE);
|
|
||||||
|
|
||||||
fp = fopen(binpath, "rb");
|
fp = fopen(binpath, "rb");
|
||||||
if(!fp)
|
if(!fp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,8 +78,12 @@ void plat_video_menu_enter(int is_rom_loaded)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char buff[256];
|
||||||
|
|
||||||
// should really only happen once, on startup..
|
// should really only happen once, on startup..
|
||||||
readpng(g_screen_ptr, "skin/background.png", READPNG_BG);
|
emu_make_path(buff, "skin/background.png", sizeof(buff));
|
||||||
|
if (readpng(g_screen_ptr, buff, READPNG_BG) < 0)
|
||||||
|
memset(g_screen_ptr, 0, 320*240*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy to buffer2
|
// copy to buffer2
|
||||||
|
|
|
@ -318,8 +318,12 @@ void plat_video_menu_enter(int is_rom_loaded)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char buff[256];
|
||||||
|
|
||||||
// should really only happen once, on startup..
|
// should really only happen once, on startup..
|
||||||
readpng(g_screen_ptr, "skin/background.png", READPNG_BG);
|
emu_make_path(buff, "skin/background.png", sizeof(buff));
|
||||||
|
if (readpng(g_screen_ptr, buff, READPNG_BG) < 0)
|
||||||
|
memset(g_screen_ptr, 0, 320*240*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(menu_bg_buffer, g_screen_ptr, 320*240*2);
|
memcpy(menu_bg_buffer, g_screen_ptr, 320*240*2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue