Difference between revisions of "Linuxlib"

From Felixl.com
Jump to navigationJump to search
(API functions)
(API functions)
 
(4 intermediate revisions by the same user not shown)
Line 8: Line 8:
 
  unsigned int videobuf_callback(unsigned char * buf);
 
  unsigned int videobuf_callback(unsigned char * buf);
  
this is callback, that freedo will call every video frame update (60 times a second). the parameter is 640x480, 32 bit, little endian, ARGB frame.
+
this is callback, that freedo will call every video frame update (60 times a second). the parameter is 640x480, 32 bit, little endian, ARGB frame. Returns 1 if everything went ok, returns 0 if there's no buffer or other problems.
 +
 
 +
unsigned int keypad_callback();
 +
 
 +
this is callback, that freedo will cal every even frame (30 times a second) to get the info about pressed keys on the keypad. up to 5 keypads are supported. the return value is a bitmask:
 +
 +
#define KEYPAD_UP            0x00000001
 +
#define KEYPAD_DOWN          0x00000002
 +
#define KEYPAD_LEFT          0x00000004
 +
#define KEYPAD_RIGHT        0x00000008
 +
#define KEYPAD_LS            0x00000010
 +
#define KEYPAD_RS            0x00000020
 +
#define KEYPAD_A            0x00000040
 +
#define KEYPAD_B            0x00000080
 +
#define KEYPAD_C            0x00000100
 +
#define KEYPAD_X            0x00000200
 +
#define KEYPAD_P            0x00000400
 +
#define KEYPAD_DISCONNECTED  0x80000008
 +
 
 +
if you want to report missing keypad (let's say for single keypad configuration) -- simply report KEYPAD_DISCONNECTED as the return value for that keypad.
 +
 
 +
unsigned int freedo_init(freedo_struct * myinstance);
 +
 
 +
this is the first function to call. But before you call it -- you have to create and set-up the freedo_struct structure, with pointers to initialized callback functions -- basically at this point all frame and audio buffers should be initialized. the return value of 0 means that something went wrong...
 +
 
 +
unsigned int freedo_loadbios(unsigned char * rom_mem);
 +
 
 +
this is second function to call. It's providing freedo with pointer to loaded bios. The allocated size should be 1 mbyte. Before calling this function you have to allocate and load the bios file. Please note -- the bios file is big endian, whilst freedo requires it to be little endian. So you will have to convert it before calling this function. the return value of 0 means that something went wrong...
 +
 
 +
unsigned int freedo_loadcd(int fd);
 +
 
 +
this is third function to call. It's providing freedo with file descriptor to ISO image or CDROM device with 3do CD inside. Before calling this function you have to open the file, verify that the file is valid 3do ISO image or 3do CDROM. (0x01 'Z' 'Z' 'Z' 'Z' 'Z' signature at the beginning of the first sector).
 +
 
 +
unsigned int freedo_start();
 +
 
 +
this is the function you were waiting for.. It starts the emulation. Please note -- it creates additional threads and returns as soon as everything went ok. The return value 1 means -- you're all set and just wait for user actions (like -- "quit" :)
 +
 
 +
void freedo_pause();
 +
 
 +
this function allows you to pause the emulation. please note -- this function is blocking -- it will not return untill the emulation is actually stopped.
 +
 
 +
void freedo_resume();
 +
 
 +
this function allows you to resume the emulation. please note -- this function is blocking -- it will not return untill the emulation is actually resumed.
 +
 
 +
void freedo_killme();
 +
 
 +
this is most important function. you have to call it to stop the emulation and kill all threads. you have to call it every time you quit from application.
  
 
== API Structures ==
 
== API Structures ==

Latest revision as of 08:10, 9 February 2007

API functions

unsigned int audiodac_callback(unsigned short left, unsigned short right);

this is callback, that freedo will call 44100 times a second to put next sample into DAC buffer. this should be blocking function -- it should wait if buffer is full. Returns 1 if everything went ok, returns 0 if there's no buffer or other problems.

unsigned int videobuf_callback(unsigned char * buf);

this is callback, that freedo will call every video frame update (60 times a second). the parameter is 640x480, 32 bit, little endian, ARGB frame. Returns 1 if everything went ok, returns 0 if there's no buffer or other problems.

unsigned int keypad_callback();

this is callback, that freedo will cal every even frame (30 times a second) to get the info about pressed keys on the keypad. up to 5 keypads are supported. the return value is a bitmask:

#define KEYPAD_UP            0x00000001
#define KEYPAD_DOWN          0x00000002
#define KEYPAD_LEFT          0x00000004
#define KEYPAD_RIGHT         0x00000008
#define KEYPAD_LS            0x00000010
#define KEYPAD_RS            0x00000020
#define KEYPAD_A             0x00000040
#define KEYPAD_B             0x00000080
#define KEYPAD_C             0x00000100
#define KEYPAD_X             0x00000200
#define KEYPAD_P             0x00000400
#define KEYPAD_DISCONNECTED  0x80000008

if you want to report missing keypad (let's say for single keypad configuration) -- simply report KEYPAD_DISCONNECTED as the return value for that keypad.

unsigned int freedo_init(freedo_struct * myinstance);

this is the first function to call. But before you call it -- you have to create and set-up the freedo_struct structure, with pointers to initialized callback functions -- basically at this point all frame and audio buffers should be initialized. the return value of 0 means that something went wrong...

unsigned int freedo_loadbios(unsigned char * rom_mem);

this is second function to call. It's providing freedo with pointer to loaded bios. The allocated size should be 1 mbyte. Before calling this function you have to allocate and load the bios file. Please note -- the bios file is big endian, whilst freedo requires it to be little endian. So you will have to convert it before calling this function. the return value of 0 means that something went wrong...

unsigned int freedo_loadcd(int fd);

this is third function to call. It's providing freedo with file descriptor to ISO image or CDROM device with 3do CD inside. Before calling this function you have to open the file, verify that the file is valid 3do ISO image or 3do CDROM. (0x01 'Z' 'Z' 'Z' 'Z' 'Z' signature at the beginning of the first sector).

unsigned int freedo_start();

this is the function you were waiting for.. It starts the emulation. Please note -- it creates additional threads and returns as soon as everything went ok. The return value 1 means -- you're all set and just wait for user actions (like -- "quit" :)

void freedo_pause();

this function allows you to pause the emulation. please note -- this function is blocking -- it will not return untill the emulation is actually stopped.

void freedo_resume();

this function allows you to resume the emulation. please note -- this function is blocking -- it will not return untill the emulation is actually resumed.

void freedo_killme();

this is most important function. you have to call it to stop the emulation and kill all threads. you have to call it every time you quit from application.

API Structures

typedef struct{
   void * audiodac_callback;
   void * videobuf_callback;
   void * keypad_callback[5];
}freedo_struct;

where all are pointers to call back functions. see function API for details

Links