Skip to content

Commit 2d5d32c

Browse files
author
iss
committed
adding android platform
1 parent 6636d49 commit 2d5d32c

File tree

12 files changed

+126
-0
lines changed

12 files changed

+126
-0
lines changed

6551.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ enum
8282
#endif
8383

8484
#ifdef __LINUX__
85+
#ifndef __ANDROID__
8586
#define BACKEND_COM
8687
#endif
88+
#endif
8789
#ifdef WIN32
8890
#define BACKEND_COM
8991
#endif

ChangeLog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Oricutron ChangeLog
33

44
pre-release changes (work in progress)
55
--------------------------------------
6+
* Added Android target platform
67
* Updated BD500 for DOS70
78
* Added option to disable menu color scheme
89
* Updated BD500 support

gui_android.c

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
** Oricutron
3+
** Copyright (C) 2009-2014 Peter Gordon
4+
**
5+
** This program is free software; you can redistribute it and/or
6+
** modify it under the terms of the GNU General Public License
7+
** as published by the Free Software Foundation, version 2
8+
** of the License.
9+
**
10+
** This program is distributed in the hope that it will be useful,
11+
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
** GNU General Public License for more details.
14+
**
15+
** You should have received a copy of the GNU General Public License
16+
** along with this program; if not, write to the Free Software
17+
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18+
**
19+
*/
20+
21+
/*
22+
* android helper by iss
23+
*/
24+
25+
26+
#include "system.h"
27+
#include "6502.h"
28+
#include "via.h"
29+
#include "8912.h"
30+
#include "gui.h"
31+
#include "disk.h"
32+
#include "monitor.h"
33+
#include "6551.h"
34+
#include "machine.h"
35+
36+
static SDL_bool initialized = SDL_FALSE;
37+
38+
SDL_bool init_gui_native( struct machine *oric )
39+
{
40+
if(!initialized)
41+
initialized = SDL_TRUE;
42+
43+
/* FIXME: ... */
44+
return initialized;
45+
}
46+
47+
void shut_gui_native( struct machine *oric )
48+
{
49+
/* FIXME: ... */
50+
initialized = SDL_FALSE;
51+
}
52+
53+
void gui_open_url( const char *url )
54+
{
55+
/* FIXME: ... */
56+
return;
57+
}

keyboard.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,3 +587,13 @@ SDL_bool load_keyboard_mapping( struct machine *oric, char *filename )
587587

588588
return ok;
589589
}
590+
591+
592+
#ifdef __ANDROID__
593+
extern struct osdmenuitem keopitems[];
594+
void togglekeyboard( struct machine *oric, struct osdmenuitem *mitem, int dummy );
595+
void android_togglekeyboard(struct machine* oric)
596+
{
597+
togglekeyboard( oric, &keopitems[0], 0 );
598+
}
599+
#endif

keyboard.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@ SDL_bool save_keyboard_mapping( struct machine *oric, char *filename );
5353

5454
SDL_bool load_keyboard_mapping( struct machine *oric, char *filename );
5555

56+
#ifdef __ANDROID__
57+
void android_togglekeyboard(struct machine* oric);
58+
#endif
59+
5660
#endif

machine.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,7 @@ SDL_bool emu_event( SDL_Event *ev, struct machine *oric, SDL_bool *needrender )
14621462
break;
14631463

14641464
case SDLK_F10:
1465+
#ifndef __ANDROID__
14651466
if( vidcap )
14661467
{
14671468
ay_lockaudio( &oric->ay );
@@ -1483,6 +1484,9 @@ SDL_bool emu_event( SDL_Event *ev, struct machine *oric, SDL_bool *needrender )
14831484
do_popup( oric, vidcapname );
14841485
}
14851486
refreshavi = SDL_TRUE;
1487+
#else
1488+
android_togglekeyboard( oric );
1489+
#endif
14861490
break;
14871491
#ifdef __CBCOPY__
14881492
case SDLK_F11:
@@ -2113,6 +2117,9 @@ void setdrivetype( struct machine *oric, struct osdmenuitem *mitem, int type )
21132117
if( !init_machine( oric, oric->type, SDL_FALSE ) )
21142118
{
21152119
shut( oric );
2120+
#ifdef __ANDROID__
2121+
error_printf("'init_machine' failed");
2122+
#endif
21162123
exit( EXIT_FAILURE );
21172124
}
21182125

@@ -2142,6 +2149,9 @@ void swapmach( struct machine *oric, struct osdmenuitem *mitem, int which )
21422149
if( !init_machine( oric, which, which!=oric->type ) )
21432150
{
21442151
shut( oric );
2152+
#ifdef __ANDROID__
2153+
error_printf("'init_machine' failed");
2154+
#endif
21452155
exit( EXIT_FAILURE );
21462156
}
21472157
}

main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,16 @@ static void usage( int ret )
605605
" \"com:115200,8,N,1,/dev/ttyUSB0\"\n"
606606
#endif
607607
"\n");
608+
609+
#ifdef __ANDROID__
610+
error_printf("Bad command line.");
611+
#endif
612+
608613
exit(ret);
609614
}
610615

611616
// Print a formatted string into a textzone
617+
#ifndef __ANDROID__
612618
void error_printf( char *fmt, ... )
613619
{
614620
static char str[256]; // Stupid MinGW32 not having vasprintf...
@@ -626,6 +632,7 @@ void error_printf( char *fmt, ... )
626632
}
627633
va_end( ap );
628634
}
635+
#endif
629636

630637
static SDL_bool on_or_off( char *arg, char *option, SDL_bool *storage )
631638
{

plugins/ch376/ch376.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ extern struct Library *SysBase;
5151
#include <dirent.h>
5252
#include <unistd.h>
5353
#include <string.h>
54+
#ifdef __ANDROID__
55+
#include <sys/vfs.h>
56+
#define statvfs statfs
57+
#else
5458
#include <sys/statvfs.h>
59+
#endif
5560
#include <sys/stat.h>
5661

5762
#else

render_sw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ void render_video_sw_32bpp( struct machine *oric, SDL_bool doublesize )
452452

453453
void render_sw_detectvideo( struct machine *oric )
454454
{
455+
#ifndef __ANDROID__
455456
int BitsPerPixel = SDL_COMPAT_GetBitsPerPixel();
456457

457458
// Guess the suitable video mode, either 16bpp or 32bpp
@@ -470,6 +471,9 @@ void render_sw_detectvideo( struct machine *oric )
470471
default:
471472
break;
472473
}
474+
#else
475+
oric->sw_depth = 32;
476+
#endif
473477
}
474478

475479
void preinit_render_sw( struct machine *oric )

system.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@
5151
#define ROMPREFIX "roms\\"
5252
#define IMAGEPREFIX "images\\"
5353

54+
#elif defined(__ANDROID__)
55+
56+
#define PATHSEP '/'
57+
#define PATHSEPSTR "/"
58+
#define FILEPREFIX "/data/data/com.emul.oricutron/files/"
59+
#define ROMPREFIX FILEPREFIX"roms/"
60+
#define IMAGEPREFIX FILEPREFIX"images/"
61+
5462
#else
5563

5664
#define PATHSEP '/'

0 commit comments

Comments
 (0)