Android related fixes
This commit is contained in:
parent
bd681499cd
commit
508a36c8f8
12 changed files with 77 additions and 62 deletions
|
@ -496,10 +496,12 @@ static void sample16i_crux_handler(void)
|
|||
data3p &= audio_channel[3].data.adk_mask;
|
||||
|
||||
{
|
||||
struct audio_channel_data *cdp;
|
||||
uae_u32 ratio, ratio1;
|
||||
#define INTERVAL (scaled_sample_evtime * 3)
|
||||
auto cdp = audio_channel + 0;
|
||||
unsigned long ratio1 = cdp->per - cdp->evtime;
|
||||
auto ratio = ulong((ratio1 << 12) / INTERVAL);
|
||||
cdp = audio_channel + 0;
|
||||
ratio1 = cdp->per - cdp->evtime;
|
||||
ratio = (ratio1 << 12) / INTERVAL;
|
||||
if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL)
|
||||
ratio = 4096;
|
||||
data0 = (data0 * ratio + data0p * (4096 - ratio)) >> 12;
|
||||
|
@ -513,14 +515,14 @@ static void sample16i_crux_handler(void)
|
|||
|
||||
cdp = audio_channel + 2;
|
||||
ratio1 = cdp->per - cdp->evtime;
|
||||
ratio = ulong((ratio1 << 12) / INTERVAL);
|
||||
ratio = (ratio1 << 12) / INTERVAL;
|
||||
if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL)
|
||||
ratio = 4096;
|
||||
data2 = (data2 * ratio + data2p * (4096 - ratio)) >> 12;
|
||||
|
||||
cdp = audio_channel + 3;
|
||||
ratio1 = cdp->per - cdp->evtime;
|
||||
ratio = ulong((ratio1 << 12) / INTERVAL);
|
||||
ratio = (ratio1 << 12) / INTERVAL;
|
||||
if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL)
|
||||
ratio = 4096;
|
||||
data3 = (data3 * ratio + data3p * (4096 - ratio)) >> 12;
|
||||
|
@ -611,31 +613,33 @@ static void sample16si_crux_handler(void)
|
|||
data3p &= audio_channel[3].data.adk_mask;
|
||||
|
||||
{
|
||||
struct audio_channel_data* cdp;
|
||||
uae_u32 ratio, ratio1;
|
||||
#define INTERVAL (scaled_sample_evtime * 3)
|
||||
auto cdp = audio_channel + 0;
|
||||
unsigned long ratio1 = cdp->per - cdp->evtime;
|
||||
auto ratio = ulong((ratio1 << 12) / INTERVAL);
|
||||
cdp = audio_channel + 0;
|
||||
ratio1 = cdp->per - cdp->evtime;
|
||||
ratio = (ratio1 << 12) / INTERVAL;
|
||||
if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL)
|
||||
ratio = 4096;
|
||||
data0 = (data0 * ratio + data0p * (4096 - ratio)) >> 12;
|
||||
|
||||
cdp = audio_channel + 1;
|
||||
ratio1 = cdp->per - cdp->evtime;
|
||||
ratio = ulong((ratio1 << 12) / INTERVAL);
|
||||
ratio = (ratio1 << 12) / INTERVAL;
|
||||
if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL)
|
||||
ratio = 4096;
|
||||
data1 = (data1 * ratio + data1p * (4096 - ratio)) >> 12;
|
||||
|
||||
cdp = audio_channel + 2;
|
||||
ratio1 = cdp->per - cdp->evtime;
|
||||
ratio = ulong((ratio1 << 12) / INTERVAL);
|
||||
ratio = (ratio1 << 12) / INTERVAL;
|
||||
if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL)
|
||||
ratio = 4096;
|
||||
data2 = (data2 * ratio + data2p * (4096 - ratio)) >> 12;
|
||||
|
||||
cdp = audio_channel + 3;
|
||||
ratio1 = cdp->per - cdp->evtime;
|
||||
ratio = ulong((ratio1 << 12) / INTERVAL);
|
||||
ratio = (ratio1 << 12) / INTERVAL;
|
||||
if (cdp->evtime < scaled_sample_evtime || ratio1 >= INTERVAL)
|
||||
ratio = 4096;
|
||||
data3 = (data3 * ratio + data3p * (4096 - ratio)) >> 12;
|
||||
|
@ -1276,6 +1280,7 @@ void update_audio(void)
|
|||
n_cycles = get_cycles() - last_cycles;
|
||||
while (n_cycles > 0) {
|
||||
auto best_evtime = n_cycles + 1;
|
||||
uae_u32 rounded;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AUDIO_CHANNELS_PAULA; i++) {
|
||||
|
@ -1284,7 +1289,7 @@ void update_audio(void)
|
|||
}
|
||||
|
||||
/* next_sample_evtime >= 0 so floor() behaves as expected */
|
||||
auto rounded = ulong(floorf(next_sample_evtime));
|
||||
rounded = floorf(next_sample_evtime);
|
||||
if (next_sample_evtime - rounded >= 0.5)
|
||||
rounded++;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "cda_play.h"
|
||||
#include "archivers/mp2/kjmp2.h"
|
||||
#ifndef _WIN32
|
||||
#if (!defined _WIN32 && !defined ANDROID)
|
||||
extern "C" {
|
||||
#include "mpeg2dec/mpeg2.h"
|
||||
#include "mpeg2dec/mpeg2convert.h"
|
||||
|
|
|
@ -526,7 +526,7 @@ TCHAR *target_expand_environment(const TCHAR *path, TCHAR *out, int maxlen)
|
|||
int target_parse_option(struct uae_prefs* p, const char* option, const char* value)
|
||||
{
|
||||
#ifdef ANDROIDSDL
|
||||
|| cfgfile_intval(option, value, "onscreen", &p->onScreen, 1)
|
||||
int result = (cfgfile_intval(option, value, "onscreen", &p->onScreen, 1)
|
||||
|| cfgfile_intval(option, value, "onscreen_textinput", &p->onScreen_textinput, 1)
|
||||
|| cfgfile_intval(option, value, "onscreen_dpad", &p->onScreen_dpad, 1)
|
||||
|| cfgfile_intval(option, value, "onscreen_button1", &p->onScreen_button1, 1)
|
||||
|
@ -554,8 +554,17 @@ int target_parse_option(struct uae_prefs* p, const char* option, const char* val
|
|||
|| cfgfile_intval(option, value, "pos_y_button6", &p->pos_y_button6, 1)
|
||||
|| cfgfile_intval(option, value, "floating_joystick", &p->floatingJoystick, 1)
|
||||
|| cfgfile_intval(option, value, "disable_menu_vkeyb", &p->disableMenuVKeyb, 1)
|
||||
);
|
||||
if (result)
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
|
||||
if (cfgfile_intval(option, value, "vertical_offset", &p->vertical_offset, 1))
|
||||
{
|
||||
p->vertical_offset += OFFSET_Y_ADJUST;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cfgfile_yesno(option, value, _T("use_retroarch_quit"), &p->use_retroarch_quit))
|
||||
return 1;
|
||||
if (cfgfile_yesno(option, value, _T("use_retroarch_menu"), &p->use_retroarch_menu))
|
||||
|
@ -563,19 +572,11 @@ int target_parse_option(struct uae_prefs* p, const char* option, const char* val
|
|||
if (cfgfile_yesno(option, value, _T("use_retroarch_reset"), &p->use_retroarch_reset))
|
||||
return 1;
|
||||
if (cfgfile_yesno(option, value, _T("use_analogue_remap"), &p->input_analog_remap))
|
||||
return 1;
|
||||
|
||||
|
||||
return 1;
|
||||
if (cfgfile_intval(option, value, "kbd_led_num", &p->kbd_led_num, 1))
|
||||
return 1;
|
||||
if (cfgfile_intval(option, value, "kbd_led_scr", &p->kbd_led_scr, 1))
|
||||
return 1;
|
||||
|
||||
if (cfgfile_intval(option, value, "vertical_offset", &p->vertical_offset, 1))
|
||||
{
|
||||
p->vertical_offset += OFFSET_Y_ADJUST;
|
||||
return 1;
|
||||
}
|
||||
if (cfgfile_intval(option, value, "hide_idle_led", &p->hide_idle_led, 1))
|
||||
return 1;
|
||||
if (cfgfile_intval(option, value, "gfx_correct_aspect", &p->gfx_correct_aspect, 1))
|
||||
|
@ -1344,9 +1345,9 @@ int handle_msgpump()
|
|||
x = -4;
|
||||
if (rEvent.motion.y == 0 && y > -4)
|
||||
y = -4;
|
||||
if (rEvent.motion.x == currprefs.gfx_size.width - 1 && x < 4)
|
||||
if (rEvent.motion.x == currprefs.gfx_monitor.gfx_size.width - 1 && x < 4)
|
||||
x = 4;
|
||||
if (rEvent.motion.y == currprefs.gfx_size.height - 1 && y < 4)
|
||||
if (rEvent.motion.y == currprefs.gfx_monitor.gfx_size.height - 1 && y < 4)
|
||||
y = 4;
|
||||
#endif //ANDROIDSDL
|
||||
setmousestate(0, 0, x * mouseScale, 0);
|
||||
|
|
|
@ -18,9 +18,12 @@
|
|||
#include <png.h>
|
||||
#include "inputdevice.h"
|
||||
|
||||
#if 0
|
||||
#ifdef ANDROIDSDL
|
||||
#include <SDL_screenkeyboard.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_DISPMANX
|
||||
#include "threaddep/thread.h"
|
||||
static uae_thread_id display_tid = nullptr;
|
||||
|
@ -460,6 +463,7 @@ void graphics_subshutdown()
|
|||
}
|
||||
}
|
||||
|
||||
#if 0 // Disabled until we see how this is implemented in SDL2
|
||||
#ifdef ANDROIDSDL
|
||||
void update_onscreen()
|
||||
{
|
||||
|
@ -524,6 +528,7 @@ void update_onscreen()
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Check if the requested Amiga resolution can be displayed with the current Screen mode as a direct multiple
|
||||
// Based on this we make the decision to use Linear (smooth) or Nearest Neighbor (pixelated) scaling
|
||||
|
@ -542,9 +547,12 @@ static void open_screen(struct uae_prefs* p)
|
|||
max_uae_height = 1080;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef ANDROIDSDL
|
||||
update_onscreen();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (screen_is_picasso)
|
||||
{
|
||||
display_width = picasso_vidinfo.width ? picasso_vidinfo.width : 640;
|
||||
|
|
|
@ -168,7 +168,7 @@ void message_checkInput()
|
|||
// Send event to gui-controls
|
||||
//-------------------------------------------------
|
||||
#ifdef ANDROIDSDL
|
||||
androidsdl_event(event, msg_input);
|
||||
androidsdl_event(msg_event, msg_input);
|
||||
#else
|
||||
msg_input->pushInput(msg_event);
|
||||
#endif
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
#include "gui_handling.h"
|
||||
#include "inputdevice.h"
|
||||
|
||||
#if 0
|
||||
#ifdef ANDROIDSDL
|
||||
#include <SDL_android.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static const char* mousespeed_list[] = {".25", ".5", "1x", "2x", "4x"};
|
||||
static const int mousespeed_values[] = {2, 5, 10, 20, 40};
|
||||
|
@ -238,11 +240,13 @@ public:
|
|||
|
||||
else if (actionEvent.getSource() == chkMouseHack)
|
||||
{
|
||||
#if 0
|
||||
#ifdef ANDROIDSDL
|
||||
if (chkMouseHack->isSelected())
|
||||
SDL_ANDROID_SetMouseEmulationMode(0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
|
||||
else
|
||||
SDL_ANDROID_SetMouseEmulationMode(1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
|
||||
#endif
|
||||
#endif
|
||||
changed_prefs.input_tablet = chkMouseHack->isSelected() ? TABLET_MOUSEHACK : TABLET_OFF;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <guichan.hpp>
|
||||
#include <SDL/SDL_ttf.h>
|
||||
#include <guichan/sdl.hpp>
|
||||
#include <guisan.hpp>
|
||||
#include <SDL_ttf.h>
|
||||
#include <guisan/sdl.hpp>
|
||||
#include "sdltruetypefont.hpp"
|
||||
#include "SelectorEntry.hpp"
|
||||
#include "UaeRadioButton.hpp"
|
||||
|
@ -405,7 +405,7 @@ void RefreshPanelOnScreen(void)
|
|||
else
|
||||
checkBox_disableMenuVKeyb->setSelected(false);
|
||||
|
||||
textInput->disableVirtualKeyboard(changed_prefs.disableMenuVKeyb);
|
||||
//textInput->disableVirtualKeyboard(changed_prefs.disableMenuVKeyb);
|
||||
|
||||
window_pos_textinput->setX(changed_prefs.pos_x_textinput);
|
||||
window_pos_textinput->setY(changed_prefs.pos_y_textinput);
|
||||
|
|
|
@ -190,8 +190,8 @@ class EditFilePathActionListener : public gcn::ActionListener
|
|||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent)
|
||||
{
|
||||
char tmp[MAX_PATH];
|
||||
strncpy(tmp, txtCurrent->getText().c_str(), MAX_PATH - 1);
|
||||
char tmp[MAX_DPATH];
|
||||
strncpy(tmp, txtCurrent->getText().c_str(), MAX_DPATH - 1);
|
||||
checkfoldername(tmp);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -132,8 +132,8 @@ class EditDirPathActionListener : public gcn::ActionListener
|
|||
public:
|
||||
void action(const gcn::ActionEvent& actionEvent)
|
||||
{
|
||||
char tmp[MAX_PATH];
|
||||
strncpy(tmp, txtCurrent->getText().c_str(), MAX_PATH - 1);
|
||||
char tmp[MAX_DPATH];
|
||||
strncpy(tmp, txtCurrent->getText().c_str(), MAX_DPATH - 1);
|
||||
checkfoldername(tmp);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#ifdef USE_SDL1
|
||||
#include <guichan/sdl.hpp>
|
||||
#elif USE_SDL2
|
||||
#include <guisan/sdl.hpp>
|
||||
#endif
|
||||
|
||||
void androidsdl_event(SDL_Event event, gcn::SDLInput* gui_input) {
|
||||
void androidsdl_event(SDL_Event gui_event, gcn::SDLInput* gui_input) {
|
||||
/*
|
||||
* Now that we are done polling and using SDL events we pass
|
||||
* the leftovers to the SDLInput object to later be handled by
|
||||
|
@ -12,26 +8,26 @@ void androidsdl_event(SDL_Event event, gcn::SDLInput* gui_input) {
|
|||
* label doesn't use input. But will do it anyway to show how to
|
||||
* set up an SDL application with Guichan.)
|
||||
*/
|
||||
if (event.type == SDL_MOUSEMOTION ||
|
||||
event.type == SDL_MOUSEBUTTONDOWN ||
|
||||
event.type == SDL_MOUSEBUTTONUP) {
|
||||
if (gui_event.type == SDL_MOUSEMOTION ||
|
||||
gui_event.type == SDL_MOUSEBUTTONDOWN ||
|
||||
gui_event.type == SDL_MOUSEBUTTONUP) {
|
||||
// Filter emulated mouse events for Guichan, we wand absolute input
|
||||
} else {
|
||||
// Convert multitouch event to SDL mouse event
|
||||
static int x = 0, y = 0, buttons = 0, wx=0, wy=0, pr=0;
|
||||
SDL_Event event2;
|
||||
memcpy(&event2, &event, sizeof(event));
|
||||
if (event.type == SDL_JOYBALLMOTION &&
|
||||
event.jball.which == 0 &&
|
||||
event.jball.ball == 0) {
|
||||
memcpy(&event2, &gui_event, sizeof(gui_event));
|
||||
if (gui_event.type == SDL_JOYBALLMOTION &&
|
||||
gui_event.jball.which == 0 &&
|
||||
gui_event.jball.ball == 0) {
|
||||
event2.type = SDL_MOUSEMOTION;
|
||||
event2.motion.which = 0;
|
||||
event2.motion.state = buttons;
|
||||
event2.motion.xrel = event.jball.xrel - x;
|
||||
event2.motion.yrel = event.jball.yrel - y;
|
||||
if (event.jball.xrel!=0) {
|
||||
x = event.jball.xrel;
|
||||
y = event.jball.yrel;
|
||||
event2.motion.xrel = gui_event.jball.xrel - x;
|
||||
event2.motion.yrel = gui_event.jball.yrel - y;
|
||||
if (gui_event.jball.xrel!=0) {
|
||||
x = gui_event.jball.xrel;
|
||||
y = gui_event.jball.yrel;
|
||||
}
|
||||
event2.motion.x = x;
|
||||
event2.motion.y = y;
|
||||
|
@ -49,9 +45,9 @@ void androidsdl_event(SDL_Event event, gcn::SDLInput* gui_input) {
|
|||
//__android_log_print(ANDROID_LOG_INFO, "GUICHAN","Mouse button %d coords %d %d", buttons, x, y);
|
||||
}
|
||||
}
|
||||
if (event.type == SDL_JOYBUTTONUP &&
|
||||
event.jbutton.which == 0 &&
|
||||
event.jbutton.button == 0) {
|
||||
if (gui_event.type == SDL_JOYBUTTONUP &&
|
||||
gui_event.jbutton.which == 0 &&
|
||||
gui_event.jbutton.button == 0) {
|
||||
// Do not push button down event here, because we need mouse motion event first
|
||||
buttons = 0;
|
||||
event2.type = SDL_MOUSEBUTTONUP;
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
#if defined(ANDROIDSDL)
|
||||
#include "androidsdl_event.h"
|
||||
#include <SDL_screenkeyboard.h>
|
||||
#include <SDL_android.h>
|
||||
//#include <SDL_screenkeyboard.h>
|
||||
//#include <SDL_android.h>
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
|
@ -733,7 +733,7 @@ void checkInput()
|
|||
// Send event to gui-controls
|
||||
//-------------------------------------------------
|
||||
#ifdef ANDROIDSDL
|
||||
androidsdl_event(event, gui_input);
|
||||
androidsdl_event(gui_event, gui_input);
|
||||
#else
|
||||
gui_input->pushInput(gui_event);
|
||||
#endif
|
||||
|
@ -1094,9 +1094,11 @@ void DisableResume()
|
|||
|
||||
void run_gui()
|
||||
{
|
||||
#if 0
|
||||
#ifdef ANDROIDSDL
|
||||
SDL_ANDROID_SetScreenKeyboardShown(0);
|
||||
SDL_ANDROID_SetSystemMousePointerVisible(1);
|
||||
#endif
|
||||
#endif
|
||||
gui_running = true;
|
||||
gui_rtarea_flags_onenter = gui_create_rtarea_flag(&currprefs);
|
||||
|
@ -1117,13 +1119,15 @@ void run_gui()
|
|||
amiberry_gui_run();
|
||||
gui_widgets_halt();
|
||||
amiberry_gui_halt();
|
||||
#if 0
|
||||
#ifdef ANDROIDSDL
|
||||
if (currprefs.onScreen != 0)
|
||||
{
|
||||
SDL_ANDROID_SetScreenKeyboardShown(1);
|
||||
SDL_ANDROID_SetSystemMousePointerVisible(0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// Catch all GUI framework exceptions.
|
||||
|
|
|
@ -570,6 +570,3 @@ typedef char TCHAR;
|
|||
#define _wunlink(x) unlink(x)
|
||||
#define _istalnum(x) isalnum(x)
|
||||
|
||||
#if defined(ANDROID) && !defined(CPU_AARCH64)
|
||||
#define log2l(x) (log(x)/log(2))
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue