Commit f180777c authored by Vladimir Serbinenko's avatar Vladimir Serbinenko
Browse files

Remove declaration-after-statement

parent 1833632d
......@@ -120,9 +120,9 @@ static char CMDFILE[512];
int loadcmdfile(char *argv)
{
int res = 0;
memset(CMDFILE, 0, sizeof(CMDFILE));
RFILE *h = filestream_open(argv, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
char *p;
memset(CMDFILE, 0, sizeof(CMDFILE));
if (h) {
filestream_read(h, CMDFILE, sizeof(CMDFILE) - 1);
filestream_close(h);
......@@ -328,8 +328,6 @@ void Screen_SetFullUpdate(int scr)
void retro_set_environment(retro_environment_t cb)
{
environ_cb = cb;
static const struct retro_controller_description p1_controllers[] = {
{ "Minivmac Joystick", RETRO_DEVICE_MINIVMAC_JOYSTICK },
{ "Minivmac Keyboard", RETRO_DEVICE_MINIVMAC_KEYBOARD },
......@@ -346,8 +344,6 @@ void retro_set_environment(retro_environment_t cb)
{ NULL, 0 }
};
cb( RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports );
struct retro_variable variables[] = {
{
"minivmac_Statusbar",
......@@ -360,12 +356,15 @@ void retro_set_environment(retro_environment_t cb)
{ NULL, NULL },
};
struct retro_vfs_interface_info vfs_interface_info;
bool no_content = true;
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
environ_cb = cb;
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
cb( RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports );
cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
struct retro_vfs_interface_info vfs_interface_info;
vfs_interface_info.required_interface_version = 3;
vfs_interface_info.iface = NULL;
if(cb(RETRO_ENVIRONMENT_GET_VFS_INTERFACE, &vfs_interface_info)) {
......@@ -451,6 +450,34 @@ static void keyboard_cb(bool down, unsigned keycode, uint32_t character, uint16_
void retro_init(void)
{
const char *system_dir = NULL;
const char *content_dir = NULL;
const char *save_dir = NULL;
#ifdef FRONTEND_SUPPORTS_RGB565
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565;
#else
enum retro_pixel_format fmt =RETRO_PIXEL_FORMAT_XRGB8888;
#endif
static struct retro_input_descriptor inputDescriptors[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "A" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "B" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "X" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Y" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Left" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "Up" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Down" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "R" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "L" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2, "R2" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "L2" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3, "R3" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3, "L3" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X, "Mouse X" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y, "Mouse Y" },
{ 0, 0, 0, 0, NULL }
};
struct retro_keyboard_callback cb = { keyboard_cb };
environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &cb);
......@@ -461,16 +488,12 @@ void retro_init(void)
retro_system_directory=system_dir;
}
const char *content_dir = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY, &content_dir) && content_dir)
{
// if defined, use the system directory
retro_content_directory=content_dir;
}
const char *save_dir = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &save_dir) && save_dir)
{
// If save directory is defined use it, otherwise use system directory
......@@ -491,41 +514,13 @@ void retro_init(void)
sprintf(retro_system_data_directory, "%s/data",RETRO_DIR);
#endif
#ifdef FRONTEND_SUPPORTS_RGB565
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565;
#else
enum retro_pixel_format fmt =RETRO_PIXEL_FORMAT_XRGB8888;
#endif
if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
{
fprintf(stderr, "PIXEL FORMAT is not supported.\n");
exit(0);
}
static struct retro_input_descriptor inputDescriptors[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "A" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "B" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "X" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Y" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Left" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "Up" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "Down" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "R" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "L" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2, "R2" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "L2" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3, "R3" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3, "L3" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X, "Mouse X" },
{ 0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y, "Mouse Y" },
{ 0, 0, 0, 0, NULL }
};
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, &inputDescriptors);
}
void retro_deinit(void)
......
......@@ -141,6 +141,7 @@ int app_event(int poll)
int app_render(int poll)
{
static int prevpoll=0,prevstate=0,reset_state=0;
int state;
if(prevpoll!=poll || reset_state){nk_clear(ctx);reset_state=0;}
if(poll==0)
......@@ -150,7 +151,7 @@ int app_render(int poll)
app_event(poll);
int state=gui(&browser,ctx);
state=gui(&browser,ctx);
if(state==1 && prevstate!=1)reset_state=1;
nk_retro_render(nk_rgba(0,0,0,0));
......
......@@ -5,6 +5,9 @@
//misc options
static int showled = nk_false;
static int current_drvtype = 2;
static int old_drvtype = 2;
int i;
if (minivmac_statusbar) {
showled = nk_true;
......@@ -12,8 +15,8 @@
else showled = nk_false;
//floppy option
static int current_drvtype = 2;
static int old_drvtype = 2;
current_drvtype = 2;
old_drvtype = 2;
// button toggle GUI/EMU
nk_layout_row_dynamic(ctx, DEFHSZ, 3);
......@@ -47,8 +50,6 @@
//floppy option
int i;
for(i=0;i<2;i++)
if(LOADCONTENT==2 && LDRIVE==(i+8));
else if( (i==0? DISKA_NAME: DISKB_NAME)!=NULL){
......
......@@ -47,6 +47,7 @@ gui(struct file_browser *browser,struct nk_context *ctx)
static nk_flags window_flags = 0;
static int minimizable = nk_false;
static int title = nk_true;
int tmpval;
/* window flags */
window_flags = 0;
......@@ -58,8 +59,6 @@ gui(struct file_browser *browser,struct nk_context *ctx)
if (minimizable) window_flags |= NK_WINDOW_MINIMIZABLE;
if (title) window_flags |= NK_WINDOW_TITLE;
int tmpval;
if(pauseg==1 && SHOWKEY==1)SHOWKEY=-1;
if(pauseg==0 && SHOWKEY==1)GUISTATE=GUI_VKBD;
if(pauseg==1 && SHOWKEY==-1 && LOADCONTENT==1)GUISTATE=GUI_BROWSE;
......
......@@ -630,8 +630,6 @@ nk_retro_handle_event(int *evt,int poll)
{
struct nk_context *ctx = &retro.ctx;
if(poll)input_poll_cb();
static int lmx=0,lmy=0;
static int mmbL=0,mmbR=0,mmbM=0;
static int mbt[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
......@@ -639,10 +637,13 @@ nk_retro_handle_event(int *evt,int poll)
int mouse_l,mouse_m,mouse_r;
int16_t mouse_x=0,mouse_y=0;
int i;
if(poll)input_poll_cb();
Process_key();
int i=2;//TOGGLE: real mouse/ joypad emulate mouse
i=2;//TOGGLE: real mouse/ joypad emulate mouse
if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && mbt[i]==0 )
mbt[i]=1;
else if ( mbt[i]==1 && ! input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) ){
......
......@@ -167,11 +167,11 @@ void Retro_FreeSurface(RSDL_Surface *surf )
RSDL_Surface *Retro_CreateRGBSurface32( int w,int h, int d, int rm,int rg,int rb,int ra)
{
printf("s(%d,%d,%d) (%x,%x,%x,%x)\n",w,h,d,rm,rg,rb,ra);
{
RSDL_Surface *bitmp;
printf("s(%d,%d,%d) (%x,%x,%x,%x)\n",w,h,d,rm,rg,rb,ra);
bitmp = (RSDL_Surface *) calloc(1, sizeof(*bitmp));
if (bitmp == NULL)
{
......@@ -257,10 +257,10 @@ RSDL_Surface *Retro_CreateRGBSurface32( int w,int h, int d, int rm,int rg,int rb
RSDL_Surface *Retro_CreateRGBSurface16( int w,int h, int d, int rm,int rg,int rb,int ra)
{
printf("s(%d,%d,%d) (%x,%x,%x,%x)\n",w,h,d,rm,rg,rb,ra);
RSDL_Surface *bitmp;
printf("s(%d,%d,%d) (%x,%x,%x,%x)\n",w,h,d,rm,rg,rb,ra);
bitmp = (RSDL_Surface *) calloc(1, sizeof(*bitmp));
if (bitmp == NULL)
{
......@@ -369,7 +369,10 @@ void Retro_Draw_string(RSDL_Surface *surface, signed short int x, signed short i
unsigned *mbuffer=(unsigned*)surface->pixels;
#endif
Sint16 left, right, top, bottom;
Sint16 x1, y1, x2, y2;
int surfw;
int surfh;
#define VIRTUAL_WIDTH surface->w
......@@ -380,9 +383,6 @@ void Retro_Draw_string(RSDL_Surface *surface, signed short int x, signed short i
#define charWidthLocal 8
#define charHeightLocal 8
Sint16 left, right, top, bottom;
Sint16 x1, y1, x2, y2;
left = surface->clip_rect.x;
x2 = x + charWidthLocal;
if (x2<left) {
......@@ -409,8 +409,8 @@ void Retro_Draw_string(RSDL_Surface *surface, signed short int x, signed short i
for(strlen = 0; strlen<maxstrlen && string[strlen]; strlen++) {}
int surfw=strlen * 7 * xscale;
int surfh=8 * yscale;
surfw=strlen * 7 * xscale;
surfh=8 * yscale;
#ifdef M16B
linesurf =(unsigned char *)malloc(sizeof(unsigned short)*surfw*surfh );
......@@ -480,6 +480,12 @@ void Retro_Draw_char(RSDL_Surface *surface, signed short int x, signed short int
unsigned *mbuffer=(unsigned*)surface->pixels;
#endif
Sint16 left, right, top, bottom;
Sint16 x1, y1, x2, y2;
int surfw;
int surfh;
#define VIRTUAL_WIDTH surface->w
if ((surface->clip_rect.w==0) || (surface->clip_rect.h==0)) {
......@@ -490,9 +496,6 @@ void Retro_Draw_char(RSDL_Surface *surface, signed short int x, signed short int
#define charWidthLocal2 7*xscale
#define charHeightLocal2 8*yscale
Sint16 left, right, top, bottom;
Sint16 x1, y1, x2, y2;
left = surface->clip_rect.x;
x2 = x + charWidthLocal2;
if (x2<left) {
......@@ -516,8 +519,8 @@ void Retro_Draw_char(RSDL_Surface *surface, signed short int x, signed short int
strlen = 1;
int surfw=strlen * 7 * xscale;
int surfh=8 * yscale;
surfw=strlen * 7 * xscale;
surfh=8 * yscale;
#ifdef M16B
linesurf =(unsigned char *)malloc(sizeof(unsigned short)*surfw*surfh );
......
......@@ -211,15 +211,16 @@ int Core_PollEvent(void)
static int jbt[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static int vbt[16]={0x1C,0x39,0x01,0x3B,0x01,0x02,0x04,0x08,0x80,0x40,0x15,0x31,0x24,0x1F,0x6E,0x6F};
static int kbt[4]={0,0,0,0};
int mouse_l;
int mouse_r;
int16_t mouse_x,mouse_y;
static int mmbL=0,mmbR=0;
// MXjoy[0]=0;
if(!retro_load_ok)
return 1;
input_poll_cb();
int mouse_l;
int mouse_r;
int16_t mouse_x,mouse_y;
mouse_x=mouse_y=0;
if(SHOWKEY==-1 && pauseg==0)
......@@ -351,8 +352,6 @@ int Core_PollEvent(void)
//slowdown=1;
static int mmbL=0,mmbR=0;
if(mmbL==0 && mouse_l)
{
mmbL=1;
......
......@@ -1038,12 +1038,10 @@ GLOBALPROC UpdateScreen(ui3p* destination, si4b top, si4b left,
#include "libretro-core.h"
void ScreenUpdate () {
si4b top, left, bottom, right;
top = 0;
left = 0;
bottom = vMacScreenHeight;
right = vMacScreenWidth;
si4b top = 0;
si4b left = 0;
si4b bottom = vMacScreenHeight;
si4b right = vMacScreenWidth;
int changesWidth = vMacScreenWidth;
int changesHeight =vMacScreenHeight;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment