From 7f55aaf80bc66d9acae7b7d4b147a6c51cfec059 Mon Sep 17 00:00:00 2001 From: meepingsnesroms Date: Fri, 26 Oct 2018 14:18:24 -0700 Subject: [PATCH] Some misc updates --- libretroBuildSystem/build/Makefile.common | 1 + .../compat/compat_posix_string.c | 104 ++++++++++++++++++ .../include/compat/posix_string.h | 61 ++++++++++ libretroBuildSystem/mu_libretro.info | 11 +- specifications/emuFeatureRegistersSpec.h | 2 + src/hardwareRegisters.c | 5 + 6 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 libretroBuildSystem/libretro-common/compat/compat_posix_string.c create mode 100644 libretroBuildSystem/libretro-common/include/compat/posix_string.h diff --git a/libretroBuildSystem/build/Makefile.common b/libretroBuildSystem/build/Makefile.common index 4d08cdc..005d017 100644 --- a/libretroBuildSystem/build/Makefile.common +++ b/libretroBuildSystem/build/Makefile.common @@ -16,6 +16,7 @@ include $(EMU_PATH)/makefile.all SOURCES_C := $(CORE_DIR)/libretro.c \ $(CORE_DIR)/cursors.c \ + $(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \ $(LIBRETRO_COMM_DIR)/compat/compat_strcasestr.c \ $(LIBRETRO_COMM_DIR)/compat/compat_strl.c \ $(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \ diff --git a/libretroBuildSystem/libretro-common/compat/compat_posix_string.c b/libretroBuildSystem/libretro-common/compat/compat_posix_string.c new file mode 100644 index 0000000..33a30e5 --- /dev/null +++ b/libretroBuildSystem/libretro-common/compat/compat_posix_string.c @@ -0,0 +1,104 @@ +/* Copyright (C) 2010-2018 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (compat_posix_string.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include + +#include + +#ifdef _WIN32 + +#undef strcasecmp +#undef strdup +#undef isblank +#undef strtok_r +#include +#include +#include +#include + +#include + +int retro_strcasecmp__(const char *a, const char *b) +{ + while (*a && *b) + { + int a_ = tolower(*a); + int b_ = tolower(*b); + + if (a_ != b_) + return a_ - b_; + + a++; + b++; + } + + return tolower(*a) - tolower(*b); +} + +char *retro_strdup__(const char *orig) +{ + size_t len = strlen(orig) + 1; + char *ret = (char*)malloc(len); + if (!ret) + return NULL; + + strlcpy(ret, orig, len); + return ret; +} + +int retro_isblank__(int c) +{ + return (c == ' ') || (c == '\t'); +} + +char *retro_strtok_r__(char *str, const char *delim, char **saveptr) +{ + char *first = NULL; + if (!saveptr || !delim) + return NULL; + + if (str) + *saveptr = str; + + do + { + char *ptr = NULL; + first = *saveptr; + while (*first && strchr(delim, *first)) + *first++ = '\0'; + + if (*first == '\0') + return NULL; + + ptr = first + 1; + + while (*ptr && !strchr(delim, *ptr)) + ptr++; + + *saveptr = ptr + (*ptr ? 1 : 0); + *ptr = '\0'; + } while (strlen(first) == 0); + + return first; +} + +#endif diff --git a/libretroBuildSystem/libretro-common/include/compat/posix_string.h b/libretroBuildSystem/libretro-common/include/compat/posix_string.h new file mode 100644 index 0000000..9f56322 --- /dev/null +++ b/libretroBuildSystem/libretro-common/include/compat/posix_string.h @@ -0,0 +1,61 @@ +/* Copyright (C) 2010-2018 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (posix_string.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_COMPAT_POSIX_STRING_H +#define __LIBRETRO_SDK_COMPAT_POSIX_STRING_H + +#include + +#ifdef _MSC_VER +#include +#endif + +RETRO_BEGIN_DECLS + +#ifdef _WIN32 +#undef strtok_r +#define strtok_r(str, delim, saveptr) retro_strtok_r__(str, delim, saveptr) + +char *strtok_r(char *str, const char *delim, char **saveptr); +#endif + +#ifdef _MSC_VER +#undef strcasecmp +#undef strdup +#define strcasecmp(a, b) retro_strcasecmp__(a, b) +#define strdup(orig) retro_strdup__(orig) +int strcasecmp(const char *a, const char *b); +char *strdup(const char *orig); + +/* isblank is available since MSVC 2013 */ +#if _MSC_VER < 1800 +#undef isblank +#define isblank(c) retro_isblank__(c) +int isblank(int c); +#endif + +#endif + + +RETRO_END_DECLS + +#endif diff --git a/libretroBuildSystem/mu_libretro.info b/libretroBuildSystem/mu_libretro.info index 35c53cc..e26994c 100644 --- a/libretroBuildSystem/mu_libretro.info +++ b/libretroBuildSystem/mu_libretro.info @@ -1,11 +1,18 @@ display_name = "Palm OS (Mu)" authors = "guicrith / meepingsnesroms" -supported_extensions = "prc|pdb|pqa" +supported_extensions = "ram" corename = "Mu" manufacturer = "Palm" categories = "Emulator" systemname = "Palm OS" license = "Non-commercial" permissions = "" -display_version = "v0.1" +display_version = "v0.9.5" supports_no_game = "true" +firmware_count = 2 +firmware0_desc = "palmos41-en-m515.rom (Palm OS 4.1 ROM)" +firmware0_path = "palmos41-en-m515.rom" +firmware0_opt = "false" +firmware1_desc = "bootloader-en-m515.rom (MC68VZ328 UART Bootloader)" +firmware1_path = "bootloader-en-m515.rom" +firmware1_opt = "true" diff --git a/specifications/emuFeatureRegistersSpec.h b/specifications/emuFeatureRegistersSpec.h index e630287..5ef18cd 100644 --- a/specifications/emuFeatureRegistersSpec.h +++ b/specifications/emuFeatureRegistersSpec.h @@ -22,6 +22,7 @@ These registers will do nothing it there corresponding feature bit is not set on #define FEATURE_EXT_KEYS 0x00000080/*enables the OS 5 buttons, left, right and select*/ #define FEATURE_DEBUG 0x00000100/*enables the debug commands, used to call Palm OS functions like native C functions*/ #define FEATURE_INVALID 0x00000200/*if this bit is set the returned data is invalid*/ +#define FEATURE_SHELL 0x00000400/*allows executing code on the host machine, is a huge securty hole and is compiled out in releases*/ /*new features go here*/ /*registers*/ @@ -49,6 +50,7 @@ These registers will do nothing it there corresponding feature bit is not set on /*new HLE API cmds go here*/ /*new system cmds go here*/ +#define CMD_SHELL_EXECUTE 0xFFF9/*execute shell commands from inside the emulator, will be used for a cool web project*/ #define CMD_SOUND 0xFFFA/*may be needed to work around the overhead of emulating SYSCLK, will be needed fo OS5 advanced sound*/ #define CMD_EXECUTION_DONE 0xFFFB/*terminates execution, used when a function is called from outside the emulator*/ #define CMD_IDLE_X_CLK32 0xFFFC/*used to remove idle loops*/ diff --git a/src/hardwareRegisters.c b/src/hardwareRegisters.c index c26d11c..6354f49 100644 --- a/src/hardwareRegisters.c +++ b/src/hardwareRegisters.c @@ -429,10 +429,15 @@ uint8_t getHwRegister8(uint32_t address){ case PMDATA: return getPortMValue(); + case PWMCNT1: + debugLog("PWMCNT1 not implimented\n"); + break; + //basic non GPIO functions case SCR: case LCKCON: case IVR: + case PWMP1: //port d special functions case PDPOL: