Skip to content

Commit

Permalink
up to MAME 0.265
Browse files Browse the repository at this point in the history
  • Loading branch information
seleuco committed Apr 27, 2024
1 parent d10d03b commit 3d0b25d
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 35 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MAME4droid-2024

MAME4droid 2024 is developed by David Valdeita (Seleuco) as a port of the MAME 0.264 emulator by MAMEDev and contributors. It emulates arcade games and systems like ZX Spectrum, Amstrad CPC, MSX etc. This version of MAME support over 40000 different ROMs.
MAME4droid 2024 is developed by David Valdeita (Seleuco) as a port of the MAME 0.265 emulator by MAMEDev and contributors. It emulates arcade games and systems like ZX Spectrum, Amstrad CPC, MSX etc. This version of MAME support over 40000 different ROMs.

* MAME4droid is an EMULATOR and DOES NOT INCLUDE ROMS OR COPYRIGHTED MATERIAL OF ANY KIND.

Expand All @@ -14,7 +14,7 @@ With over 40000 games and system supported, some games will run better than othe

After installing, place your MAME-titled zipped ROMs in /storage/emulated/0/Android/data/com.seleuco.mame4d2024/files/roms folder (Read the help to see other possibilities for reading your ROMs).

This MAME4droid version uses only '0.264' romset.
This MAME4droid version uses only '0.265' romset.

FEATURES
========
Expand Down
4 changes: 2 additions & 2 deletions android-MAME4droid/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.seleuco.mame4d2024"
minSdkVersion 29
targetSdkVersion 34
versionCode 49
versionName '1.11.1'
versionCode 50
versionName '1.12'
setProperty("archivesBaseName", "MAME4droid 2024-$versionName")
ndk {
moduleName "mame4droid-jni"
Expand Down
1 change: 1 addition & 0 deletions android-MAME4droid/app/src/main/assets/changelog.htm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ <h3>MAME4droid CHANGELOG<br>
<ul>

</li>
<li><b>2024-04-26 Version 1.12 </b><br/>Updated to MAME 0.265.</li>
<li><b>2024-03-26 Version 1.11 </b><br/>Updated to MAME 0.264. Improved haptics. Added BSP-D8 controller support. Added some new nogeo shaders.</li>
<li><b>2024-02-28 Version 1.10 </b><br/>Updated to MAME 0.263. Improved SAF support for MESS software media. Added right stick and analog triggers support to generic controllers</li>
<li><b>2024-02-09 Version 1.9 </b><br/>Added media scraping thanks to Arcade Database by motoschifo. Added MAME meta data resources thanks to Arcade History, MAME info and progetto-SNAPS</li>
Expand Down
2 changes: 1 addition & 1 deletion android-MAME4droid/app/src/main/assets/credits.htm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h1 class="title">Credits</h1>
<h3>MAME4droid</h3>
<ul>
<li>MAME4droid by David Valdeita (<a class="link" href="mailto:[email protected]" target="new">Seleuco</a>)</li>
<li>MAME 0.264 original version by MAMEDev and contributors.</li>
<li>MAME 0.265 original version by MAMEDev and contributors.</li>
<li>Art by Bryn Thompson.</li>
</ul>
<h3>Acknowledgments</h3>
Expand Down
2 changes: 1 addition & 1 deletion android-MAME4droid/app/src/main/assets/games.htm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 class="title">Supported Games</h1>
<div class="content">
<h3>Supported Games<br>
</h3>
<p>MAME4droid 2024 uses game ROMs from the MAME '0.264' ROM set (March 2024). Note: This is different than the ROMs used in <em>MAME4droid (0.139u1)</em>. These ROMs cannot be used interchangeably.</p>
<p>MAME4droid 2024 uses game ROMs from the MAME '0.265' ROM set (April 2024). Note: This is different than the ROMs used in <em>MAME4droid (0.139u1)</em>. These ROMs cannot be used interchangeably.</p>
<h3>ROM Location and Naming Convention</h3>
<p>ROMs should be placed in the &quot;roms&quot; folder of your MAME4droid installation folder. In a default install of MAME4droid, this path is <em>/storage/emulated/0/Android/data/ com.seleuco.mame4d2024/files/roms</em>. You should copy your roms from a PC using the Android Debug Bridge (ADB) tool</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ public class Emulator {
final static public int AUTOFIRE = 71;
final static public int INPUTMACRO = 72;
final static public int HISCORE = 73;
final static public int UI_MOUSE_AS_POINTER = 74;


//set str
final static public int SAF_PATH = 1;
final static public int ROM_NAME = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ public void updateEmuValues() {
Emulator.setValue(Emulator.HISCORE, mm.getPrefsHelper()
.isHiscore() ? 1 : 0);

Emulator.setValue(Emulator.UI_MOUSE_AS_POINTER, mm.getPrefsHelper()
.isTouchMouseAsPointer() ? 1 : 0);

Emulator.setValue(Emulator.VBEAM2X, mm.getPrefsHelper()
.isVectorBeam2x() ? 1 : 0);
Emulator.setValue(Emulator.VFLICKER, mm.getPrefsHelper()
Expand Down Expand Up @@ -822,7 +825,7 @@ public void showHelp() {
.setInfoMsg(
"When MAME4droid is first run, it will create a folder structure for you on the internal memory of your Android device. This folder contains all the other folders MAME uses as well as some basic configuration files."
+ "Since MAME4droid does not come with game ROM files, you will need to copy them to (You can change it in options to external storage if your device allows it) '/storage/emulated/0/Android/media/com.seleuco.mame4d2024/roms' folder (" +
"the one that applies) yourself. These should be properly named, ZIPped MAME v0.264 ROMs files with the filenames in all lower case.\n\nImportant: You should define or map your Android TV game controller on 'options/settings/input/External controller/define Keys' to avoid this help screen constantly showing if the controller is not auto detected.\n\n"
"the one that applies) yourself. These should be properly named, ZIPped MAME v0.265 ROMs files with the filenames in all lower case.\n\nImportant: You should define or map your Android TV game controller on 'options/settings/input/External controller/define Keys' to avoid this help screen constantly showing if the controller is not auto detected.\n\n"
+ "Controls: Buttons A,B,C,D,E,F on the controller map to buttons Button MAME 1 to 6 buttons."
+ " Coin button inserts coin/adds credit.START button starts 1P game. A+START is fast forward. B+START is toggle UI controls. START+A+B is service mode. SELECT+A+B is soft reset. Use SELECT(coin) or START for UI navigation."
+ "R1 + START loads a save state. L1 + START saves a save state. START + SELECT when gaming accesses the game's MAME menu (dip switches, etc)...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
}

public void onSurfaceChanged(GL10 gl, int w, int h) {
Log.v("mm", "sizeChanged: ==> new Viewport: [" + w + "," + h + "]");
Log.v(TAG, "sizeChanged: ==> new Viewport: [" + w + "," + h + "]");

width = w;
height = h;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified android-MAME4droid/app/src/main/res/raw/files.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion android-MAME4droid/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<string name="menu_quit">Exit App</string>
<string name="app_name">MAME4droid 2024</string>
<string name="don_t_bother">Don\'t ask again</string>
<string name="mame_version">0.264</string>
<string name="mame_version">0.265</string>
</resources>

Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
android:title="Touch mouse" android:summary="Enable touch mouse support"
android:defaultValue="True" />

<CheckBoxPreference android:key="PREF_TOUCH_MOUSE_AS_POINTER"
<com.seleuco.mame4droid.prefs.CheckBoxPrefWithWarn android:key="PREF_TOUCH_MOUSE_AS_POINTER"
android:title="Touch mouse as pointer" android:summary="Enable to use touch mouse as pointer in frontend instead classic mouse."
android:defaultValue="True" android:dependency="PREF_TOUCH_MOUSE"/>

Expand Down
44 changes: 33 additions & 11 deletions src/osd/myosd/myosd-droid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ static int myosd_plugin_autofire = 0;
static int myosd_plugin_inputmacro = 0;
static int myosd_plugin_hiscore = 0;

static int myosd_ui_mouse_as_pointer = 0;

//vector options
static int myosd_droid_vector_beam2x = 1;
static int myosd_droid_vector_flicker = 0;
Expand Down Expand Up @@ -432,6 +434,9 @@ void myosd_droid_setMyValue(int key, int i, int value) {
case com_seleuco_mame4droid_Emulator_HISCORE:
myosd_plugin_hiscore = value;
break;
case com_seleuco_mame4droid_Emulator_UI_MOUSE_AS_POINTER:
myosd_ui_mouse_as_pointer = value;
break;
}
}

Expand Down Expand Up @@ -591,13 +596,19 @@ int myosd_droid_setKeyData(int keyCode,int keyAction,char keyChar) {

int myosd_droid_setMouseData(int i, int mouseAction, int button, float cx, float cy) {

/*
/*
__android_log_print(ANDROID_LOG_DEBUG,
"MAME4droid.so", "set mouseData %d %d %d %f %f -> %d %d",i, mouseAction,
button, cx, cy, (int)cur_x_mouse, (int)cur_y_mouse);
*/
if(i>4) return 1;

static bool bt1_double_click = false;

if(mouseAction == com_seleuco_mame4droid_Emulator_MOUSE_MOVE)
{
//__android_log_print(ANDROID_LOG_DEBUG, "libMAME4droid.so", "MOUSEB MOUSE MOVE!!!!");

cur_x_mouse = MAX(0, MIN(cx + cur_x_mouse, myosd_droid_video_width));
cur_y_mouse = MAX(0, MIN(cy + cur_y_mouse, myosd_droid_video_height));

Expand Down Expand Up @@ -635,9 +646,6 @@ int myosd_droid_setMouseData(int i, int mouseAction, int button, float cx, float

if(button==1) {

ev.type = ev.MYOSD_MOUSE_BT1_DOWN;
myosd_pushEvent(ev);

static float last_click_x = 0;
static float last_click_y = 0;
static std::chrono::steady_clock::time_point last_click_time = std::chrono::steady_clock::time_point::min();
Expand All @@ -658,8 +666,7 @@ int myosd_droid_setMouseData(int i, int mouseAction, int button, float cx, float
&& (cur_y_mouse >= (last_click_y - offsetY) && cur_y_mouse <= (last_click_y + offsetY)))
{
last_click_time = std::chrono::time_point<std::chrono::steady_clock>::min();
ev.type = ev.MYOSD_MOUSE_BT1_DBLCLK;
myosd_pushEvent(ev);
bt1_double_click = true;
__android_log_print(ANDROID_LOG_DEBUG, "libMAME4droid.so", "MOUSEB PULSO BT1 DBLCLK!!!!");
}
else
Expand All @@ -669,6 +676,10 @@ int myosd_droid_setMouseData(int i, int mouseAction, int button, float cx, float
last_click_y = cur_y_mouse;
}

ev.type = ev.MYOSD_MOUSE_BT1_DOWN;
ev.data.mouse_data.double_click = bt1_double_click;
myosd_pushEvent(ev);

mouse_status[i] |= MYOSD_A;
__android_log_print(ANDROID_LOG_DEBUG, "libMAME4droid.so", "MOUSEB PULSO BT1!");
}
Expand All @@ -692,6 +703,8 @@ int myosd_droid_setMouseData(int i, int mouseAction, int button, float cx, float
if(button==1)
{
ev.type = ev.MYOSD_MOUSE_BT1_UP;
ev.data.mouse_data.double_click = bt1_double_click;
bt1_double_click = false;
myosd_pushEvent(ev);
mouse_status[i] &= ~MYOSD_A;
}
Expand Down Expand Up @@ -886,12 +899,17 @@ static void droid_init(void) {
int efective_reswidth = MAX(MAX(reswidth,reswidth_osd),640);
int efective_resheight = MAX(MAX(resheight,resheight_osd),480);

if (screenbuffer1 == nullptr)
screenbuffer1 = (unsigned char *) malloc(efective_reswidth * efective_resheight * PIXEL_PITCH);

if(myosd_droid_dbl_buffer && screenbuffer2==NULL)
screenbuffer2 = (unsigned char *)malloc(efective_reswidth * efective_resheight * PIXEL_PITCH);
if (screenbuffer1 == nullptr) {
screenbuffer1 = (unsigned char *) malloc(
efective_reswidth * efective_resheight * PIXEL_PITCH);
__android_log_print(ANDROID_LOG_DEBUG, "MAME4droid.so", "init creating screenbuffer1 %d %d",efective_reswidth,efective_resheight);
}

if(myosd_droid_dbl_buffer && screenbuffer2==NULL) {
screenbuffer2 = (unsigned char *) malloc(
efective_reswidth * efective_resheight * PIXEL_PITCH);
__android_log_print(ANDROID_LOG_DEBUG, "MAME4droid.so", "init creating screenbuffer2 %d %d",efective_reswidth,efective_resheight);
}
myosd_screen_ptr = myosd_droid_dbl_buffer ? screenbuffer2 : screenbuffer1;

if (initVideo_callback != nullptr)
Expand Down Expand Up @@ -1344,6 +1362,10 @@ int myosd_droid_main(int argc, char **argv) {
args[n] = plugin_list.c_str();n++;
}

if(myosd_ui_mouse_as_pointer) {
args[n] = "-noui_mouse";n++;
}

if(0)
{
args[n] = "-v";n++;
Expand Down
2 changes: 1 addition & 1 deletion src/osd/myosd/myosd_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,14 @@ typedef struct {
MYOSD_MOUSE_MOVE_EVENT,
MYOSD_MOUSE_BT1_DOWN,
MYOSD_MOUSE_BT1_UP,
MYOSD_MOUSE_BT1_DBLCLK,
MYOSD_MOUSE_BT2_DOWN,
MYOSD_MOUSE_BT2_UP,
} type;
union {
char key_char;
struct {
int x, y;
bool double_click;
} mouse_data;
} data;
} myosd_inputevent;
Expand Down
77 changes: 64 additions & 13 deletions src/osd/myosd/myosdmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,30 +177,81 @@ extern "C" void myosd_speed_hack()
//============================================================
extern "C" void myosd_pushEvent(myosd_inputevent event)
{
static unsigned buttons = 0;

if(osdInterface!= nullptr && osdInterface->isMachine() && osdInterface->target()!= nullptr) {

switch(event.type) {
case event.MYOSD_KEY_EVENT:
osdInterface->machine().ui_input().push_char_event(osdInterface->target(), event.data.key_char);
break;
case event.MYOSD_MOUSE_MOVE_EVENT:
osdInterface->machine().ui_input().push_mouse_move_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
break;
case event.MYOSD_MOUSE_BT1_DBLCLK:
osdInterface->machine().ui_input().push_mouse_double_click_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
case event.MYOSD_MOUSE_MOVE_EVENT: {
//osdInterface->machine().ui_input().push_mouse_move_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
osdInterface->machine().ui_input().push_pointer_update(
osdInterface->target(),
osd::ui_event_handler::pointer::MOUSE,
-1,
1,
event.data.mouse_data.x, event.data.mouse_data.y,
0, 0, 0, 0);
break;
case event.MYOSD_MOUSE_BT1_DOWN:
osdInterface->machine().ui_input().push_mouse_down_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
}
case event.MYOSD_MOUSE_BT1_DOWN: {
//osdInterface->machine().ui_input().push_mouse_down_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
unsigned pressed = (1) << 0;
buttons |= pressed;
osdInterface->machine().ui_input().push_pointer_update(
osdInterface->target(),
osd::ui_event_handler::pointer::MOUSE,
-1,
1,
event.data.mouse_data.x, event.data.mouse_data.y,
buttons, pressed, 0, event.data.mouse_data.double_click ? 2 : 1);

break;
case event.MYOSD_MOUSE_BT1_UP:
osdInterface->machine().ui_input().push_mouse_up_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
}
case event.MYOSD_MOUSE_BT1_UP: {
//osdInterface->machine().ui_input().push_mouse_up_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
unsigned released = (1) << 0;
buttons &= ~released;
osdInterface->machine().ui_input().push_pointer_update(
osdInterface->target(),
osd::ui_event_handler::pointer::MOUSE,
-1,
1,
event.data.mouse_data.x, event.data.mouse_data.y,
buttons, 0, released, event.data.mouse_data.double_click ? 2 : 1);

break;
case event.MYOSD_MOUSE_BT2_DOWN:
osdInterface->machine().ui_input().push_mouse_rdown_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
}
case event.MYOSD_MOUSE_BT2_DOWN: {
//osdInterface->machine().ui_input().push_mouse_rdown_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
unsigned pressed = (1) << 1;
buttons |= pressed;
osdInterface->machine().ui_input().push_pointer_update(
osdInterface->target(),
osd::ui_event_handler::pointer::MOUSE,
-1,
1,
event.data.mouse_data.x, event.data.mouse_data.y,
buttons, pressed, 0, 1);

break;
case event.MYOSD_MOUSE_BT2_UP:
osdInterface->machine().ui_input().push_mouse_rup_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
}
case event.MYOSD_MOUSE_BT2_UP: {
//osdInterface->machine().ui_input().push_mouse_rup_event(osdInterface->target(), event.data.mouse_data.x, event.data.mouse_data.y);
unsigned released = (1) << 1;
buttons &= ~released;
osdInterface->machine().ui_input().push_pointer_update(
osdInterface->target(),
osd::ui_event_handler::pointer::MOUSE,
-1,
1,
event.data.mouse_data.x, event.data.mouse_data.y,
buttons, 0, released, 1);

break;
}
default:
osd_printf_error("has unknown myosd event type (%u)\n",event.type);
}
Expand Down

0 comments on commit 3d0b25d

Please sign in to comment.