mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Rockboy - gameboy emulation for rockbox, based on gnuboy. Still a bit early, but already playable on iRiver H1xx and the simulators. The archos recorder version is currently rather slow...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6104 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
48dad47df9
commit
384de10246
56 changed files with 9225 additions and 1 deletions
81
apps/plugins/rockboy.c
Normal file
81
apps/plugins/rockboy.c
Normal file
|
@ -0,0 +1,81 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2005 Jens Arnold
|
||||
*
|
||||
* Overlay loader for rockboy on Archos
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "plugin.h"
|
||||
|
||||
#if MEM <= 8 && !defined(SIMULATOR)
|
||||
|
||||
#define OVL_NAME "/.rockbox/viewers/rockboy.ovl"
|
||||
#define OVL_DISPLAYNAME "RockBoy"
|
||||
|
||||
struct plugin_api* rb;
|
||||
unsigned char *mp3buf;
|
||||
int mp3buf_size;
|
||||
|
||||
/* this is the plugin entry point */
|
||||
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||
{
|
||||
int fh, readsize;
|
||||
struct {
|
||||
unsigned long magic;
|
||||
unsigned char *start_addr;
|
||||
unsigned char *end_addr;
|
||||
enum plugin_status(*entry_point)(struct plugin_api*, void*);
|
||||
} header;
|
||||
|
||||
/* this macro should be called as the first thing you do in the plugin.
|
||||
it test that the api version and model the plugin was compiled for
|
||||
matches the machine it is running on */
|
||||
TEST_PLUGIN_API(api);
|
||||
rb = api;
|
||||
|
||||
fh = rb->open(OVL_NAME, O_RDONLY);
|
||||
if (fh < 0)
|
||||
{
|
||||
rb->splash(2*HZ, true, "Couldn't open " OVL_DISPLAYNAME " overlay.");
|
||||
return PLUGIN_ERROR;
|
||||
}
|
||||
readsize = rb->read(fh, &header, sizeof(header));
|
||||
if (readsize != sizeof(header) || header.magic != 0x524f564c)
|
||||
{
|
||||
rb->close(fh);
|
||||
rb->splash(2*HZ, true, OVL_NAME " is not a valid Rockbox overlay.");
|
||||
return PLUGIN_ERROR;
|
||||
}
|
||||
|
||||
mp3buf = rb->plugin_get_mp3_buffer(&mp3buf_size);
|
||||
if (header.start_addr < mp3buf || header.end_addr > mp3buf + mp3buf_size)
|
||||
{
|
||||
rb->close(fh);
|
||||
rb->splash(2*HZ, true, OVL_DISPLAYNAME
|
||||
" overlay doesn't fit into memory.");
|
||||
return PLUGIN_ERROR;
|
||||
}
|
||||
rb->lseek(fh, 0, SEEK_SET);
|
||||
readsize = rb->read(fh, header.start_addr, header.end_addr - header.start_addr);
|
||||
rb->close(fh);
|
||||
if (readsize != header.end_addr - header.start_addr)
|
||||
{
|
||||
rb->splash(2*HZ, true, "Error loading " OVL_DISPLAYNAME " overlay.");
|
||||
return PLUGIN_ERROR;
|
||||
}
|
||||
return header.entry_point(api, parameter);
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue