Skip to content

Commit

Permalink
update to MAME 264
Browse files Browse the repository at this point in the history
  • Loading branch information
ToddLa committed Apr 22, 2024
1 parent e74e859 commit 9430a17
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 122 deletions.
7 changes: 6 additions & 1 deletion make-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi
if [ "$1" == "ios" ]; then
shift
export BUILDDIR=build-ios
export ARCHOPTS="-arch arm64 -isysroot `xcodebuild -version -sdk iphoneos Path` -miphoneos-version-min=$VERSION_MIN"
export ARCHOPTS="-arch arm64 -isysroot `xcodebuild -version -sdk iphoneos Path` -miphoneos-version-min=$VERSION_MIN -target arm64-apple-ios$VERSION_MIN"
LIBMAME=libmame-ios
fi

Expand Down Expand Up @@ -162,6 +162,11 @@ fi
## common OPTS
export ARCHOPTS="$ARCHOPTS -fPIC"

## add -mcrc for arm64
if [[ $ARCHOPTS == *arm64* ]]; then
export ARCHOPTS="$ARCHOPTS -mcrc"
fi

## hack to get sqlite to build
export ARCHOPTS="$ARCHOPTS -DHAVE_GETHOSTUUID=0"

Expand Down
2 changes: 2 additions & 0 deletions scripts/src/osd/ios.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ project ("osd_" .. _OPTIONS["osd"])
MAME_DIR .. "src/osd/osdnet.h",
MAME_DIR .. "src/osd/watchdog.cpp",
MAME_DIR .. "src/osd/watchdog.h",
MAME_DIR .. "src/osd/interface/nethandler.cpp",
MAME_DIR .. "src/osd/interface/nethandler.h",
}

includedirs {
Expand Down
138 changes: 116 additions & 22 deletions src/osd/ios/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ void input_profile_init(running_machine &machine)
//============================================================
void ios_osd_interface::input_update(bool relative_reset)
{
osd_printf_verbose("ios_osd_interface::input_update\n");
// TODO: handle relative_reset!!
osd_printf_verbose("ios_osd_interface::input_update relative_reset=%d\n", relative_reset);

// fill in the input profile the first time
if (g_input.num_ways == 0) {
Expand All @@ -354,9 +355,11 @@ void ios_osd_interface::input_update(bool relative_reset)
// determine if we should disable the rest of the UI
bool has_keyboard = g_input.num_keyboard != 0; // machine_info().has_keyboard();

// TODO: need way to get ui_active() state, for NOW just assume ui_active==true
//mame_ui_manager *ui = dynamic_cast<mame_ui_manager *>(&machine.ui());
//bool ui_disabled = (has_keyboard && !ui->ui_active());
bool ui_disabled = (has_keyboard && false);
// TODO: need way to get ui_active() state, for NOW just assume ui_active==true

// set the current input mode
g_input.input_mode = in_menu ? MYOSD_INPUT_MODE_MENU : (ui_disabled ? MYOSD_INPUT_MODE_KEYBOARD : MYOSD_INPUT_MODE_NORMAL);
Expand Down Expand Up @@ -385,25 +388,19 @@ void ios_osd_interface::check_osd_inputs()
// customize_input_type_list
//============================================================

// joystick D-Pad
#define JOYCODE_HATUP(n) input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT1UP)
#define JOYCODE_HATDOWN(n) input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT1DOWN)
#define JOYCODE_HATLEFT(n) input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT1LEFT)
#define JOYCODE_HATRIGHT(n) input_code(DEVICE_CLASS_JOYSTICK, n, ITEM_CLASS_SWITCH, ITEM_MODIFIER_NONE, ITEM_ID_HAT1RIGHT)

void ios_osd_interface::customize_input_type_list(std::vector<input_type_entry> &typelist)
{
// This function is called on startup, before reading the
// configuration from disk. Scan the list, and change the
// default control mappings you want. It is quite possible
// you won't need to change a thing.

//osd_printf_debug("INPUT TYPE LIST\n");
osd_printf_verbose("INPUT TYPE LIST\n");

// loop over the defaults
for (input_type_entry &entry : typelist) {

//osd_printf_debug(" %s TYPE:%d PLAYER:%d\n", entry.name() ?: "", entry.type(), entry.player());
osd_printf_verbose(" %s TYPE:%d PLAYER:%d\n", entry.name().c_str(), entry.type(), entry.player());

switch (entry.type())
{
Expand Down Expand Up @@ -431,18 +428,29 @@ void ios_osd_interface::customize_input_type_list(std::vector<input_type_entry>

// allow the DPAD to move the UI
case IPT_UI_UP:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HATUP(0);
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HAT1UP;
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_Y_UP_SWITCH;
break;
case IPT_UI_DOWN:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HATDOWN(0);
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HAT1DOWN;
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_Y_DOWN_SWITCH;
break;
case IPT_UI_LEFT:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HATLEFT(0);
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HAT1LEFT_INDEXED(0); // JOYCODE_HAT1LEFT
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_X_LEFT_SWITCH;
break;
case IPT_UI_RIGHT:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HATRIGHT(0);
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HAT1RIGHT;
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_X_RIGHT_SWITCH;
break;

case IPT_UI_SELECT:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON1;
break;
//case IPT_UI_CANCEL:
case IPT_UI_BACK:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON2;
break;

/* allow L1 and R1 to move pages in MAME UI */
case IPT_UI_PAGE_UP:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON5;
Expand All @@ -451,25 +459,111 @@ void ios_osd_interface::customize_input_type_list(std::vector<input_type_entry>
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON6;
break;

/* these are mostly the same as MAME defaults, except we add dpad to them */
/* left joystick, these are mostly the same as MAME defaults, except we add dpad to them */
case IPT_JOYSTICK_UP:
case IPT_JOYSTICKLEFT_UP:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HATUP(entry.player());
break;
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HAT1UP_INDEXED(entry.player());
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_Y_UP_SWITCH_INDEXED(entry.player());
break;
case IPT_JOYSTICK_DOWN:
case IPT_JOYSTICKLEFT_DOWN:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HATDOWN(entry.player());
break;
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HAT1DOWN_INDEXED(entry.player());
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_Y_DOWN_SWITCH_INDEXED(entry.player());
break;
case IPT_JOYSTICK_LEFT:
case IPT_JOYSTICKLEFT_LEFT:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HATLEFT(entry.player());
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HAT1LEFT_INDEXED(entry.player());
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_X_LEFT_SWITCH_INDEXED(entry.player());
break;
case IPT_JOYSTICK_RIGHT:
case IPT_JOYSTICKLEFT_RIGHT:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HATRIGHT(entry.player());
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_HAT1RIGHT_INDEXED(entry.player());
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_X_RIGHT_SWITCH_INDEXED(entry.player());
break;

// right joystick
case IPT_JOYSTICKRIGHT_UP:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_U_NEG_SWITCH_INDEXED(entry.player());
break;
case IPT_JOYSTICKRIGHT_DOWN:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_U_POS_SWITCH_INDEXED(entry.player());
break;
case IPT_JOYSTICKRIGHT_RIGHT:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_V_POS_SWITCH_INDEXED(entry.player());
break;
case IPT_JOYSTICKRIGHT_LEFT:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_V_NEG_SWITCH_INDEXED(entry.player());
break;

// analog joystick
case IPT_AD_STICK_X:
case IPT_TRACKBALL_X:
case IPT_LIGHTGUN_X:
case IPT_PEDAL:
case IPT_DIAL:
case IPT_PADDLE:
case IPT_POSITIONAL:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_X_INDEXED(entry.player());
entry.defseq(SEQ_TYPE_DECREMENT) |= JOYCODE_HAT1LEFT_INDEXED(entry.player());
entry.defseq(SEQ_TYPE_INCREMENT) |= JOYCODE_HAT1RIGHT_INDEXED(entry.player());
break;
case IPT_AD_STICK_Y:
case IPT_TRACKBALL_Y:
case IPT_LIGHTGUN_Y:
case IPT_DIAL_V:
case IPT_PADDLE_V:
case IPT_POSITIONAL_V:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_Y_INDEXED(entry.player());
entry.defseq(SEQ_TYPE_DECREMENT) |= JOYCODE_HAT1UP_INDEXED(entry.player());
entry.defseq(SEQ_TYPE_INCREMENT) |= JOYCODE_HAT1DOWN_INDEXED(entry.player());
break;

case IPT_AD_STICK_Z:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_Z_INDEXED(entry.player());
break;

// A,B,X,Y
case IPT_BUTTON1:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON1_INDEXED(entry.player());
break;
case IPT_BUTTON2:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON2_INDEXED(entry.player());
break;
case IPT_BUTTON3:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON3_INDEXED(entry.player());
break;
case IPT_BUTTON4:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON4_INDEXED(entry.player());
break;
// L,R
case IPT_BUTTON5:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON5_INDEXED(entry.player());
break;
case IPT_BUTTON6:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON6_INDEXED(entry.player());
break;
// L2,R2,L3,R3
case IPT_BUTTON7:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON7_INDEXED(entry.player());
break;
case IPT_BUTTON8:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON8_INDEXED(entry.player());
break;
case IPT_BUTTON9:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON9_INDEXED(entry.player());
break;
case IPT_BUTTON10:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_BUTTON10_INDEXED(entry.player());
break;
// Select, Start
case IPT_SELECT:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_SELECT_INDEXED(entry.player());
break;
case IPT_START:
entry.defseq(SEQ_TYPE_STANDARD) |= JOYCODE_START_INDEXED(entry.player());
break;

// leave everything else alone
// leave everything else alone
default:
break;
}
Expand Down
19 changes: 12 additions & 7 deletions src/osd/ios/iosmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extern "C" int myosd_main(int argc, char** argv, myosd_callbacks* callbacks, siz
memset(&host_callbacks, 0, sizeof(host_callbacks));
memcpy(&host_callbacks, callbacks, MIN(sizeof(host_callbacks), sizeof(myosd_callbacks)));

if (argc == 0) {
if (argc == 0 || argv == NULL) {
static const char* args[] = {"myosd"};
argc = 1;
argv = (char**)args;
Expand Down Expand Up @@ -579,6 +579,9 @@ void osd_setup_osd_specific_emu_options(emu_options &opts)
opts.add_entries(s_option_entries);
}

// TODO: the 7z library has changed, this is removed for now.
#if 0

//============================================================
// myosd_enumerate_7z
// give the host the ability to enumerate the file names in a 7z file
Expand All @@ -595,24 +598,24 @@ extern "C" int myosd_enumerate_7z(const char* path, int load_data_flag, void* ca
{
CSzArEx db;
CFileInStream archiveStream;
CLookToRead lookStream;
CLookToRead2 lookStream;
ISzAlloc alloc = {SzAlloc, SzFree};
ISzAlloc alloc_temp = {SzAllocTemp, SzFreeTemp};

if (InFile_Open(&archiveStream.file, path) != 0)
return -1;

FileInStream_CreateVTable(&archiveStream);
LookToRead_CreateVTable(&lookStream, False);
LookToRead2_CreateVTable(&lookStream, False);

lookStream.realStream = &archiveStream.s;
LookToRead_Init(&lookStream);
lookStream.realStream = &archiveStream.vt;
LookToRead2_INIT(&lookStream);

if (g_CrcTable[1] == 0)
CrcGenerateTable(); // *YES* this is needed!!

SzArEx_Init(&db);
int err = SzArEx_Open(&db, &lookStream.s, &alloc, &alloc_temp);
int err = SzArEx_Open(&db, &lookStream.vt, &alloc, &alloc_temp);
if (err == 0) {

uint32_t blockIndex = 0xFFFFFFFF; /* it can have any value before first call (if outBuffer = 0) */
Expand All @@ -635,7 +638,7 @@ extern "C" int myosd_enumerate_7z(const char* path, int load_data_flag, void* ca
size_t offset = 0;
size_t outSizeProcessed = 0;

int res = SzArEx_Extract(&db, &lookStream.s, i,
int res = SzArEx_Extract(&db, &lookStream.vt, i,
&blockIndex, &outBuffer, &outBufferSize,
&offset, &outSizeProcessed,
&alloc, &alloc_temp);
Expand All @@ -656,4 +659,6 @@ extern "C" int myosd_enumerate_7z(const char* path, int load_data_flag, void* ca
return err;
}

#endif


10 changes: 8 additions & 2 deletions src/osd/ios/iososd.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//============================================================
// DebugLog
//============================================================
#define DebugLog 1
#define DebugLog 0
#if DebugLog == 0
#define osd_printf_debug(...) (void)0
#endif
Expand Down Expand Up @@ -40,6 +40,11 @@ extern int myosd_display_height;
// TYPE DEFINITIONS
//============================================================

// forward references
class input_type_entry;
namespace osd { class midi_input_port; class midi_output_port; }
namespace ui { class menu_item; }

class ios_osd_interface : public osd_interface, osd_output
{
public:
Expand Down Expand Up @@ -80,7 +85,8 @@ class ios_osd_interface : public osd_interface, osd_output
virtual bool execute_command(const char *command) override {return true;}

// midi interface
virtual std::unique_ptr<osd_midi_device> create_midi_device() override {return nullptr;}
virtual std::unique_ptr<osd::midi_input_port> create_midi_input(std::string_view name) override {return nullptr;}
virtual std::unique_ptr<osd::midi_output_port> create_midi_output(std::string_view name) override {return nullptr;}

// osd_output
virtual void output_callback(osd_output_channel channel, const util::format_argument_pack<char> &args) override;
Expand Down
Loading

0 comments on commit 9430a17

Please sign in to comment.