mirror of
https://github.com/libretro/Mu.git
synced 2026-02-13 21:24:19 +00:00
Compare commits
8 Commits
wip-macosa
...
1.3.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45154c0c73 | ||
|
|
5e5e21e302 | ||
|
|
8223b6fd76 | ||
|
|
dee65d0d1a | ||
|
|
865acf3a28 | ||
|
|
15bb26daa5 | ||
|
|
dc854cef9e | ||
|
|
91a46734dd |
@@ -58,6 +58,10 @@ include:
|
||||
- project: 'libretro-infrastructure/ci-templates'
|
||||
file: '/ios-arm64.yml'
|
||||
|
||||
# tvOS
|
||||
- project: 'libretro-infrastructure/ci-templates'
|
||||
file: '/tvos-arm64.yml'
|
||||
|
||||
################################## CONSOLES ################################
|
||||
# Dingux (GCW Zero)
|
||||
- project: 'libretro-infrastructure/ci-templates'
|
||||
@@ -192,6 +196,12 @@ libretro-build-ios-arm64:
|
||||
- .libretro-ios-arm64-make-default
|
||||
- .core-defs
|
||||
|
||||
# tvOS
|
||||
libretro-build-tvos-arm64:
|
||||
extends:
|
||||
- .libretro-tvos-arm64-make-default
|
||||
- .core-defs
|
||||
|
||||
################################### CONSOLES #################################
|
||||
# Dingux (GCW Zero)
|
||||
libretro-build-dingux-mips32:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
cmake_minimum_required (VERSION 3.13)
|
||||
project(Mu
|
||||
VERSION 1.3.0
|
||||
VERSION 1.3.2
|
||||
DESCRIPTION "Classic Palm OS Emulator."
|
||||
HOMEPAGE_URL https://github.com/libretro/Mu
|
||||
LANGUAGES C CXX)
|
||||
|
||||
@@ -45,13 +45,15 @@ static void debugLog(char* str, ...){};
|
||||
//config options
|
||||
#define EMU_FPS 60
|
||||
#define DBVZ_SYSCLK_PRECISION 2000000//the amount of cycles to run before adding SYSCLKs, higher = faster, higher values may skip timer events and lower audio accuracy
|
||||
|
||||
#define AUDIO_SAMPLE_RATE 48000
|
||||
#define AUDIO_SAMPLES_PER_FRAME (AUDIO_SAMPLE_RATE / EMU_FPS)
|
||||
|
||||
#define AUDIO_SPEAKER_RANGE 0x6000//prevent hitting the top or bottom of the speaker when switching direction rapidly
|
||||
#define SD_CARD_NCR_BYTES 1//how many 0xFF bytes come before the R1 response
|
||||
#define SAVE_STATE_VERSION 0x00000001
|
||||
|
||||
//shared constants
|
||||
#define AUDIO_SAMPLES_PER_FRAME (AUDIO_SAMPLE_RATE / EMU_FPS)
|
||||
#define SD_CARD_BLOCK_SIZE 512//all newer SDSC cards have this fixed at 512
|
||||
#define SD_CARD_BLOCK_DATA_PACKET_SIZE (1 + SD_CARD_BLOCK_SIZE + 2)
|
||||
#define SD_CARD_RESPONSE_FIFO_SIZE (SD_CARD_BLOCK_DATA_PACKET_SIZE * 3)
|
||||
|
||||
@@ -32,6 +32,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
set(MU_LIBRETRO_DIR "$ENV{APPDATA}/RetroArch")
|
||||
endif()
|
||||
else()
|
||||
find_program(RETROARCH_APP retroarch)
|
||||
if(RETROARCH_APP)
|
||||
get_filename_component(MU_LIBRETRO_DIR "${RETROARCH_APP}" DIRECTORY)
|
||||
endif()
|
||||
|
||||
set(MU_LIBRETRO_EXTENSION "")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -186,6 +186,8 @@ else ifeq ($(platform), tvos-arm64)
|
||||
ifeq ($(IOSSDK),)
|
||||
IOSSDK := $(shell xcodebuild -version -sdk appletvos Path)
|
||||
endif
|
||||
CC = clang -arch arm64 -isysroot $(IOSSDK)
|
||||
CXX = clang++ -arch arm64 -isysroot $(IOSSDK)
|
||||
|
||||
# Theos iOS
|
||||
else ifeq ($(platform), theos_ios)
|
||||
@@ -391,7 +393,9 @@ else ifneq (,$(findstring armv,$(platform)))
|
||||
# Emscripten
|
||||
else ifeq ($(platform), emscripten)
|
||||
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
||||
AR=emar
|
||||
STATIC_LINKING = 1
|
||||
STATIC_LINKING_LINK = 1
|
||||
|
||||
# GCW0
|
||||
else ifeq ($(platform), gcw0)
|
||||
@@ -535,9 +539,7 @@ all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
@echo "** BUILDING $(TARGET) FOR PLATFORM $(platform) **"
|
||||
ifeq ($(platform), emscripten)
|
||||
$(CC) $(CFLAGS) $(OBJOUT)$@ $^
|
||||
else ifeq ($(STATIC_LINKING_LINK), 1)
|
||||
ifeq ($(STATIC_LINKING_LINK), 1)
|
||||
ifneq (,$(findstring msvc,$(platform)))
|
||||
$(LD) $(LINKOUT)$@ $(OBJECTS)
|
||||
else
|
||||
|
||||
@@ -213,7 +213,7 @@ void retro_get_system_info(struct retro_system_info *info){
|
||||
#ifndef GIT_VERSION
|
||||
#define GIT_VERSION ""
|
||||
#endif
|
||||
info->library_version = "v1.3.1" GIT_VERSION;
|
||||
info->library_version = "v1.3.2" GIT_VERSION;
|
||||
info->need_fullpath = true;
|
||||
info->valid_extensions = "prc|pqa|img|pdb|zip";
|
||||
|
||||
@@ -712,12 +712,16 @@ bool retro_load_game(const struct retro_game_info *info){
|
||||
strlcat(saveRamPath, osVersion, PATH_MAX_LENGTH);
|
||||
strlcat(saveRamPath, ".ram", PATH_MAX_LENGTH);
|
||||
saveRamFile = filestream_open(saveRamPath, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
if(saveRamFile){
|
||||
hasSram = true;
|
||||
|
||||
// There is now always SRAM because it gets initialized to garbage
|
||||
hasSram = true;
|
||||
|
||||
if(saveRamFile) {
|
||||
if(filestream_get_size(saveRamFile) == emulatorGetRamSize()){
|
||||
filestream_read(saveRamFile, palmRam, emulatorGetRamSize());
|
||||
swap16BufferIfLittle(palmRam, emulatorGetRamSize() / sizeof(uint16_t));
|
||||
}
|
||||
|
||||
filestream_close(saveRamFile);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ supported_extensions = "prc|pqa|img|pdb|zip"
|
||||
corename = "Mu"
|
||||
license = "CC BY-NC 3.0 US (Non-commercial)"
|
||||
permissions = ""
|
||||
display_version = "v1.3.1"
|
||||
display_version = "v1.3.2"
|
||||
categories = "Emulator"
|
||||
|
||||
# Hardware Information
|
||||
|
||||
@@ -47,6 +47,7 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
stateManager = new StateManager(this);
|
||||
emuDebugger = new DebugViewer(this);
|
||||
refreshDisplay = new QTimer(this);
|
||||
|
||||
audioDevice = new QAudioOutput(format, this);
|
||||
audioOut = audioDevice->start();
|
||||
|
||||
@@ -226,7 +227,10 @@ void MainWindow::updateDisplay(){
|
||||
ui->display->repaint();
|
||||
|
||||
//audio
|
||||
audioOut->write((const char*)emu.getAudioSamples(), AUDIO_SAMPLES_PER_FRAME * 2/*channels*/ * sizeof(int16_t));
|
||||
if (audioOut != NULL) {
|
||||
audioOut->write((const char*)emu.getAudioSamples(),
|
||||
AUDIO_SAMPLES_PER_FRAME * 2/*channels*/ * sizeof(int16_t));
|
||||
}
|
||||
|
||||
//power LED
|
||||
ui->powerButtonLed->setStyleSheet(emu.getPowerButtonLed() ? "background: lime" : "");
|
||||
|
||||
@@ -99,6 +99,23 @@ static void patchOsRom(uint32_t address, char* patch){
|
||||
swap16BufferIfLittle(&palmRom[swapBegin], swapSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills the initial RAM with garbage.
|
||||
*
|
||||
* @param ram The RAM to fill.
|
||||
* @param size The size of RAM.
|
||||
* @since 2024/06/14
|
||||
*/
|
||||
void mu_garbage_fill(uint8_t* ram, uint32_t size) {
|
||||
uint32_t i;
|
||||
uint8_t vis;
|
||||
|
||||
vis = 179;
|
||||
for (i = 0; i < size; i++) {
|
||||
ram[i] = vis;
|
||||
vis = ((vis << 1) | ((vis >> 7) & 1)) ^ 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t emulatorInit(uint8_t emulatedDevice, uint8_t* palmRomData, uint32_t palmRomSize, uint8_t* palmBootloaderData, uint32_t palmBootloaderSize, bool syncRtc, bool allowInvalidBehavior){
|
||||
if(emulatorInitialized)
|
||||
@@ -173,7 +190,9 @@ uint32_t emulatorInit(uint8_t emulatedDevice, uint8_t* palmRomData, uint32_t pal
|
||||
|
||||
//allocate buffers, add 4 to memory regions to prevent SIGSEGV from accessing off the end
|
||||
palmRom = malloc(M5XX_ROM_SIZE + 4);
|
||||
palmRam = malloc((palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE) + 4);
|
||||
|
||||
palmRam = malloc((emulatorGetRamSize()) + 4);
|
||||
|
||||
palmFramebuffer = malloc(160 * 220 * sizeof(uint16_t));
|
||||
palmAudio = malloc(AUDIO_SAMPLES_PER_FRAME * 2 * sizeof(int16_t));
|
||||
palmAudioResampler = blip_new(AUDIO_SAMPLE_RATE);//have 1 second of samples
|
||||
@@ -191,7 +210,10 @@ uint32_t emulatorInit(uint8_t emulatedDevice, uint8_t* palmRomData, uint32_t pal
|
||||
if(palmRomSize < M5XX_ROM_SIZE)
|
||||
memset(palmRom + palmRomSize, 0x00, M5XX_ROM_SIZE - palmRomSize);
|
||||
swap16BufferIfLittle(palmRom, M5XX_ROM_SIZE / sizeof(uint16_t));
|
||||
memset(palmRam, 0x00, palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE);
|
||||
|
||||
memset(palmRam, 0x00, emulatorGetRamSize());
|
||||
mu_garbage_fill(palmRam, emulatorGetRamSize());
|
||||
|
||||
dbvzLoadBootloader(palmBootloaderData, palmBootloaderSize);
|
||||
memcpy(palmFramebuffer + 160 * 160, silkscreen160x60, 160 * 60 * sizeof(uint16_t));
|
||||
memset(palmAudio, 0x00, AUDIO_SAMPLES_PER_FRAME * 2/*channels*/ * sizeof(int16_t));
|
||||
@@ -262,7 +284,7 @@ void emulatorHardReset(void){
|
||||
}
|
||||
else{
|
||||
#endif
|
||||
memset(palmRam, 0x00, palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE);
|
||||
memset(palmRam, 0x00, emulatorGetRamSize());
|
||||
emulatorSoftReset();
|
||||
sdCardReset();
|
||||
dbvzSetRtc(0, 0, 0, 0);
|
||||
@@ -330,7 +352,7 @@ uint32_t emulatorGetStateSize(void){
|
||||
size += sed1376StateSize();
|
||||
size += ads7846StateSize();
|
||||
size += pdiUsbD12StateSize();
|
||||
size += palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE;//system RAM buffer
|
||||
size += emulatorGetRamSize();//system RAM buffer
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
}
|
||||
#endif
|
||||
@@ -402,9 +424,9 @@ bool emulatorSaveState(uint8_t* data, uint32_t size){
|
||||
offset += pdiUsbD12StateSize();
|
||||
|
||||
//memory
|
||||
memcpy(data + offset, palmRam, palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE);
|
||||
swap16BufferIfLittle(data + offset, (palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE) / sizeof(uint16_t));
|
||||
offset += palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE;
|
||||
memcpy(data + offset, palmRam, emulatorGetRamSize());
|
||||
swap16BufferIfLittle(data + offset, (emulatorGetRamSize()) / sizeof(uint16_t));
|
||||
offset += emulatorGetRamSize();
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
}
|
||||
#endif
|
||||
@@ -526,9 +548,9 @@ bool emulatorLoadState(uint8_t* data, uint32_t size){
|
||||
offset += pdiUsbD12StateSize();
|
||||
|
||||
//memory
|
||||
memcpy(palmRam, data + offset, palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE);
|
||||
swap16BufferIfLittle(palmRam, (palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE) / sizeof(uint16_t));
|
||||
offset += palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE;
|
||||
memcpy(palmRam, data + offset, emulatorGetRamSize());
|
||||
swap16BufferIfLittle(palmRam, (emulatorGetRamSize()) / sizeof(uint16_t));
|
||||
offset += emulatorGetRamSize();
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
}
|
||||
#endif
|
||||
@@ -608,7 +630,9 @@ uint32_t emulatorGetRamSize(void){
|
||||
if(palmEmulatingTungstenT3)
|
||||
return TUNGSTEN_T3_RAM_SIZE;
|
||||
#endif
|
||||
return palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE;
|
||||
if (palmEmulatingM500)
|
||||
return M500_RAM_SIZE;
|
||||
return M515_RAM_SIZE;
|
||||
}
|
||||
|
||||
bool emulatorSaveRam(uint8_t* data, uint32_t size){
|
||||
@@ -621,11 +645,11 @@ bool emulatorSaveRam(uint8_t* data, uint32_t size){
|
||||
}
|
||||
else{
|
||||
#endif
|
||||
if(size < (palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE))
|
||||
if(size < (emulatorGetRamSize()))
|
||||
return false;
|
||||
|
||||
memcpy(data, palmRam, palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE);
|
||||
swap16BufferIfLittle(data, (palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE) / sizeof(uint16_t));
|
||||
memcpy(data, palmRam, emulatorGetRamSize());
|
||||
swap16BufferIfLittle(data, (emulatorGetRamSize()) / sizeof(uint16_t));
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
}
|
||||
#endif
|
||||
@@ -643,11 +667,11 @@ bool emulatorLoadRam(uint8_t* data, uint32_t size){
|
||||
}
|
||||
else{
|
||||
#endif
|
||||
if(size < (palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE))
|
||||
if(size < (emulatorGetRamSize()))
|
||||
return false;
|
||||
|
||||
memcpy(palmRam, data, palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE);
|
||||
swap16BufferIfLittle(palmRam, (palmEmulatingM500 ? M500_RAM_SIZE : M515_RAM_SIZE) / sizeof(uint16_t));
|
||||
memcpy(palmRam, data, emulatorGetRamSize());
|
||||
swap16BufferIfLittle(palmRam, (emulatorGetRamSize()) / sizeof(uint16_t));
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user