libretro-core.c 16.9 KB
Newer Older
Libretro-Admin's avatar
Libretro-Admin committed
1
2
3
4
5
6
7
8
9
10
#include <ctype.h>

#include <sys/types.h>
#include <sys/time.h>
#include <time.h>

#ifdef WIIU
#include <features_cpu.h>
#endif

Vladimir Serbinenko's avatar
Vladimir Serbinenko committed
11
12
13
#include <libretro.h>
#include <streams/file_stream.h>
#include <retro_dirent.h>
R-type's avatar
R-type committed
14
15
#include "libretro-core.h"
#include "MACkeymap.h"
Libretro-Admin's avatar
Libretro-Admin committed
16
#include "vkbd.i"
R-type's avatar
R-type committed
17

Libretro-Admin's avatar
Libretro-Admin committed
18
#define CORE_NAME "Mini vMac"
Libretro-Admin's avatar
Libretro-Admin committed
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

extern int MOUSE_EMULATED;
extern int SHOWKEY;

/* Forward declarations */
int app_init(void);
int app_free(void);
int app_render(int poll);

void Emu_init(void);
void Emu_uninit(void);
void minivmac_main_exit(void);
void emu_reset(void);

void RunEmulatedTicksToTrueTime(void);
void ScreenUpdate(void);
int InitOSGLU(int argc, char **argv);
void retro_poll_event(int joyon);
void retro_key_up(int key);
void retro_key_down(int key);
void retro_loop(void);
40
void retro_init_time(void);
Libretro-Admin's avatar
Libretro-Admin committed
41
42

/* Variables */
R-type's avatar
R-type committed
43
44
45
46
47
48
49
#ifdef _WIN32
char slash = '\\';
#else
char slash = '/';
#endif

bool retro_load_ok = false;
Vladimir Serbinenko's avatar
Vladimir Serbinenko committed
50
struct retro_vfs_interface *vfs_interface;
R-type's avatar
R-type committed
51
52
53
54
55
56
57
58
59
60
61
62

char RETRO_DIR[512];

char DISKA_NAME[512]="\0";
char DISKB_NAME[512]="\0";
char TAPE_NAME[512]="\0";
char RETRO_ROM[512];


int cpuloop=1;

#ifdef FRONTEND_SUPPORTS_RGB565
Libretro-Admin's avatar
Libretro-Admin committed
63
64
65
uint16_t *Retro_Screen;
uint16_t bmp[WINDOW_SIZE];
uint16_t save_Screen[WINDOW_SIZE];
R-type's avatar
R-type committed
66
#else
Libretro-Admin's avatar
Libretro-Admin committed
67
68
69
unsigned int *Retro_Screen;
unsigned int bmp[WINDOW_SIZE];
unsigned int save_Screen[WINDOW_SIZE];
R-type's avatar
R-type committed
70
71
72
73
74
75
#endif 

int minivmac_statusbar=0;

short signed int SNDBUF[1024*2];

Libretro-Admin's avatar
Libretro-Admin committed
76
/* FIXME: handle 50/60 */
R-type's avatar
R-type committed
77
78
79
80
int snd_sampler = 22255 / 60;

char RPATH[512];

Libretro-Admin's avatar
Libretro-Admin committed
81
int pauseg=0;
R-type's avatar
R-type committed
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
int want_quit=0;
int minivmac_kbdtype=0;

int CROP_WIDTH;
int CROP_HEIGHT;
int VIRTUAL_WIDTH;

int	retrow=640;
int	retroh=480;

unsigned minivmac_devices[ 2 ];

extern int RETROSTATUS;

const char *retro_save_directory;
const char *retro_system_directory;
const char *retro_content_directory;
char retro_system_data_directory[512];;

/*static*/ retro_input_state_t input_state_cb;
/*static*/ retro_input_poll_t input_poll_cb;
static retro_video_refresh_t video_cb;
static retro_audio_sample_t audio_cb;
static retro_audio_sample_batch_t audio_batch_cb;
static retro_environment_t environ_cb;

void retro_set_input_state(retro_input_state_t cb)
{
   input_state_cb = cb;
}

void retro_set_input_poll(retro_input_poll_t cb)
{
   input_poll_cb = cb;
}

static char CMDFILE[512];

int loadcmdfile(char *argv)
{
Libretro-Admin's avatar
Libretro-Admin committed
122
   int res  = 0;
Vladimir Serbinenko's avatar
Vladimir Serbinenko committed
123
124
   RFILE *h = filestream_open(argv, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
   char *p;
125
   memset(CMDFILE, 0, sizeof(CMDFILE));
Vladimir Serbinenko's avatar
Vladimir Serbinenko committed
126
127
128
129
   if (h) {
	   filestream_read(h, CMDFILE, sizeof(CMDFILE) - 1);
	   filestream_close(h);
	   res = 1;
R-type's avatar
R-type committed
130
131
   }

Vladimir Serbinenko's avatar
Vladimir Serbinenko committed
132
133
134
135
136
137
138
   p = strchr(CMDFILE, '\n');
   if (p)
	   *p = '\0';
   p = strchr(CMDFILE, '\r');
   if (p)
	   *p = '\0';

R-type's avatar
R-type committed
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
   return res;
}

int HandleExtension(char *path,char *ext)
{
   int len = strlen(path);

   if (len >= 4 &&
         path[len-4] == '.' &&
         path[len-3] == ext[0] &&
         path[len-2] == ext[1] &&
         path[len-1] == ext[2])
      return 1;

   return 0;
}

//Args for experimental_cmdline
static char ARGUV[64][1024];
static unsigned char ARGUC=0;

// Args for Core
static char XARGV[64][1024];
static const char* xargv_cmd[64];
int PARAMCOUNT=0;

extern int  skel_main(int argc, char *argv[]);
void parse_cmdline( const char *argv );

void Add_Option(const char* option)
{
   static int first=0;

   if(first==0)
   {
      PARAMCOUNT=0;	
      first++;
   }

   sprintf(XARGV[PARAMCOUNT++],"%s",option);
}

int pre_main(const char *argv)
{
   int i=0;
   bool Only1Arg;

   if (strlen(argv) > strlen("cmd"))
   {
      if( HandleExtension((char*)argv,"cmd") || HandleExtension((char*)argv,"CMD"))
         i=loadcmdfile((char*)argv);     
   }

   if(i==1)
      parse_cmdline(CMDFILE);      
   else
      parse_cmdline(argv); 

   Only1Arg = (strcmp(ARGUV[0],CORE_NAME) == 0) ? 0 : 1;

   for (i = 0; i<64; i++)
      xargv_cmd[i] = NULL;


   if(Only1Arg)
Libretro-Admin's avatar
Libretro-Admin committed
204
205
   {
      Add_Option(CORE_NAME);
R-type's avatar
R-type committed
206
207
208
209
210
211
212
213
      /*
         if (strlen(RPATH) >= strlen("crt"))
         if(!strcasecmp(&RPATH[strlen(RPATH)-strlen("crt")], "crt"))
         Add_Option("-cartcrt");
         */
      Add_Option(RPATH/*ARGUV[0]*/);
   }
   else
Libretro-Admin's avatar
Libretro-Admin committed
214
215
   {
      // Pass all cmdline args
R-type's avatar
R-type committed
216
217
218
219
220
221
222
      for(i = 0; i < ARGUC; i++)
         Add_Option(ARGUV[i]);
   }

   for (i = 0; i < PARAMCOUNT; i++)
      xargv_cmd[i] = (char*)(XARGV[i]);

Libretro-Admin's avatar
Libretro-Admin committed
223
   // skel_main(PARAMCOUNT,( char **)xargv_cmd); 
R-type's avatar
R-type committed
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
   InitOSGLU(PARAMCOUNT,( char **)xargv_cmd); 

   xargv_cmd[PARAMCOUNT - 2] = NULL;

   return 0;
}

void parse_cmdline(const char *argv)
{
   char *p,*p2,*start_of_word;
   int c,c2;
   static char buffer[512*4];
   enum states { DULL, IN_WORD, IN_STRING } state = DULL;

   strcpy(buffer,argv);
   strcat(buffer," \0");

   for (p = buffer; *p != '\0'; p++)
   {
      c = (unsigned char) *p; /* convert to unsigned char for is* functions */
      switch (state)
      {
         case DULL: /* not in a word, not in a double quoted string */
            if (isspace(c)) /* still not in a word, so ignore this char */
               continue;
            /* not a space -- if it's a double quote we go to IN_STRING, else to IN_WORD */
            if (c == '"')
            {
               state = IN_STRING;
               start_of_word = p + 1; /* word starts at *next* char, not this one */
               continue;
            }
            state = IN_WORD;
            start_of_word = p; /* word starts here */
            continue;
         case IN_STRING:
            /* we're in a double quoted string, so keep going until we hit a close " */
            if (c == '"')
            {
               /* word goes from start_of_word to p-1 */
               //... do something with the word ...
               for (c2 = 0,p2 = start_of_word; p2 < p; p2++, c2++)
                  ARGUV[ARGUC][c2] = (unsigned char) *p2;
               ARGUC++; 

               state = DULL; /* back to "not in word, not in string" state */
            }
            continue; /* either still IN_STRING or we handled the end above */
         case IN_WORD:
            /* we're in a word, so keep going until we get to a space */
            if (isspace(c))
            {
               /* word goes from start_of_word to p-1 */
               //... do something with the word ...
               for (c2 = 0,p2 = start_of_word; p2 <p; p2++,c2++)
                  ARGUV[ARGUC][c2] = (unsigned char) *p2;
               ARGUC++; 

               state = DULL; /* back to "not in word, not in string" state */
            }
            continue; /* either still IN_WORD or we handled the end above */
      }	
   }
}

long GetTicks(void)
{ // in MSec
#ifndef _ANDROID_

293
#if defined(WIIU)
R-type's avatar
R-type committed
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
return (cpu_features_get_time_usec());///1000;
#else
   struct timeval tv;
   gettimeofday (&tv, NULL);
   return (tv.tv_sec*1000000 + tv.tv_usec);///1000;

#endif

#else

   struct timespec now;
   clock_gettime(CLOCK_MONOTONIC, &now);
   return (now.tv_sec*1000000 + now.tv_nsec/1000);///1000;
#endif

} 

void save_bkg(void)
{
   memcpy(save_Screen,Retro_Screen,PITCH*WINDOW_SIZE);
}

void restore_bgk(void)
{
   memcpy(Retro_Screen,save_Screen,PITCH*WINDOW_SIZE);
}

void Screen_SetFullUpdate(int scr)
{
   if(scr==0 ||scr>1)
      memset(&Retro_Screen, 0, sizeof(Retro_Screen));
   if(scr>0)
      memset(&bmp,0,sizeof(bmp));
}

void retro_set_environment(retro_environment_t cb)
{
   static const struct retro_controller_description p1_controllers[] = {
      { "Minivmac Joystick", RETRO_DEVICE_MINIVMAC_JOYSTICK },
      { "Minivmac Keyboard", RETRO_DEVICE_MINIVMAC_KEYBOARD },
   };
   static const struct retro_controller_description p2_controllers[] = {
      { "Minivmac Joystick", RETRO_DEVICE_MINIVMAC_JOYSTICK },
      { "Minivmac Keyboard", RETRO_DEVICE_MINIVMAC_KEYBOARD },
   };


   static const struct retro_controller_info ports[] = {
      { p1_controllers, 2  }, // port 1
      { p2_controllers, 2  }, // port 2
      { NULL, 0 }
   };

   struct retro_variable variables[] = {
      {
         "minivmac_Statusbar",
         "Status Bar; disabled|enabled",
      },
      {
         "minivmac_kbdtype",
         "Keyboard Type; Callback|Poll",
      },
      { NULL, NULL },
   };

359
   struct retro_vfs_interface_info vfs_interface_info;
360
361
   bool no_content = true;

362
363
364
365
   environ_cb = cb;

   cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &no_content);
   cb( RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports );
R-type's avatar
R-type committed
366
   cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
Vladimir Serbinenko's avatar
Vladimir Serbinenko committed
367
368
369
370
371
372
373
374

   vfs_interface_info.required_interface_version = 3;
   vfs_interface_info.iface = NULL;
   if(cb(RETRO_ENVIRONMENT_GET_VFS_INTERFACE, &vfs_interface_info)) {
	   vfs_interface = vfs_interface_info.iface;
   }
   dirent_vfs_init(&vfs_interface_info);
   filestream_vfs_init(&vfs_interface_info);
R-type's avatar
R-type committed
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
}

static void update_variables(void)
{

   struct retro_variable var;

   var.key = "minivmac_Statusbar";
   var.value = NULL;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
   {
         if (strcmp(var.value, "enabled") == 0)
            minivmac_statusbar=1;
         if (strcmp(var.value, "disabled") == 0)
            minivmac_statusbar=0;
   }

   var.key = "minivmac_kbdtype";
   var.value = NULL;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
   {
         if (strcmp(var.value, "Callback") == 0)
            minivmac_kbdtype=0;
         if (strcmp(var.value, "Poll") == 0)
            minivmac_kbdtype=1;
   }

}


void Emu_init(void)
{
#ifdef RETRO_AND
   MOUSE_EMULATED=1;
#endif 
   update_variables();
   pre_main(RPATH);
}

void Emu_uninit(void)
{
   //minivmac_main_exit();
}

void retro_shutdown_core(void)
{
   environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
}

void retro_reset(void)
{
   emu_reset();
}

static void keyboard_cb(bool down, unsigned keycode, uint32_t character, uint16_t mod)
{
	unsigned char cpck=SDLKeyToMACScanCode[keycode];

  	// printf( "Down: %s, Code: %d, Char: %u, Mod: %u. ,(%d)\n",
  	//       down ? "yes" : "no", keycode, character, mod,cpck);

	if (keycode>=320 || minivmac_kbdtype==1);
	else{
		
		if(down && cpck!=0xff)		
			retro_key_down(cpck);	
		else if(!down && cpck!=0xff)
			retro_key_up(cpck);

	}

}

void retro_init(void)
{    	
   const char *system_dir = NULL;
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
   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 } 
   };
R-type's avatar
R-type committed
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638

   struct retro_keyboard_callback cb = { keyboard_cb };
   environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &cb);

   if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &system_dir) && system_dir)
   {
      // if defined, use the system directory			
      retro_system_directory=system_dir;		
   }		   

   if (environ_cb(RETRO_ENVIRONMENT_GET_CONTENT_DIRECTORY, &content_dir) && content_dir)
   {
      // if defined, use the system directory			
      retro_content_directory=content_dir;		
   }			

   if (environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &save_dir) && save_dir)
   {
      // If save directory is defined use it, otherwise use system directory
      retro_save_directory = *save_dir ? save_dir : retro_system_directory;      
   }
   else
   {
      // make retro_save_directory the same in case RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY is not implemented by the frontend
      retro_save_directory=retro_system_directory;
   }

   if(retro_system_directory==NULL)sprintf(RETRO_DIR, "%s",".");
   else sprintf(RETRO_DIR, "%s", retro_system_directory);

#if defined(__WIN32__) 
   sprintf(retro_system_data_directory, "%s\\data",RETRO_DIR);
#else
   sprintf(retro_system_data_directory, "%s/data",RETRO_DIR);
#endif

   if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
   {
      fprintf(stderr, "PIXEL FORMAT is not supported.\n");
      exit(0);
   }

   environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, &inputDescriptors);
}

void retro_deinit(void)
{
   app_free(); 
   Emu_uninit(); 
}

unsigned retro_api_version(void)
{
   return RETRO_API_VERSION;
}


void retro_set_controller_port_device( unsigned port, unsigned device )
{
   if ( port < 2 )
   {
      minivmac_devices[ port ] = device;

      printf(" (%d)=%d \n",port,device);
   }
}

void retro_get_system_info(struct retro_system_info *info)
{
   memset(info, 0, sizeof(*info));
   info->library_name     = CORE_NAME;
   info->library_version  = "b36";
   info->valid_extensions = "dsk|img|zip|hvf|cmd";
   info->need_fullpath    = true;
   info->block_extract    = false;

}

void retro_get_system_av_info(struct retro_system_av_info *info)
{
   struct retro_game_geometry geom = { retrow, retroh, retrow, retroh,4.0 / 3.0 };
   struct retro_system_timing timing = { 60.0, 22255.0 };

   info->geometry = geom;
   info->timing   = timing;
}

void retro_set_audio_sample(retro_audio_sample_t cb)
{
   audio_cb = cb;
}

void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
{
   audio_batch_cb = cb;
}

void retro_set_video_refresh(retro_video_refresh_t cb)
{
   video_cb = cb;
}

void retro_audio_cb( short l, short r)
{
   audio_cb(l,r);
}

void retro_audiocb(signed short int *sound_buffer,int sndbufsize){
   int x; 
   if(pauseg==0)for(x=0;x<sndbufsize;x++)audio_cb(sound_buffer[x],sound_buffer[x]);	
}

void retro_blit(void)
{
   memcpy(Retro_Screen,bmp,PITCH*WINDOW_SIZE);
}

void retro_run(void)
{
   static int mfirst=1;
   bool updated = false;

   if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
      update_variables();

   if(mfirst==1)
   {
      mfirst++;
      printf("MAIN FIRST\n");
      retro_load_ok=true;

      Emu_init();
      return;
   }

   if(pauseg==0)
   {
      retro_loop();
		ScreenUpdate();
		//update_input();
retro_poll_event(0);
      retro_blit();
      if(SHOWKEY==1)app_render(0);
   }
   else if (pauseg==1)app_render(1);
   //app_render(pauseg);

   video_cb(Retro_Screen,retrow,retroh,retrow<<PIXEL_BYTES);

   if(want_quit)retro_shutdown_core();
}

bool retro_load_game(const struct retro_game_info *info)
{
   /*
      struct retro_keyboard_callback cb = { keyboard_cb };
      environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &cb);
      */
639
   memset(RPATH, 0, sizeof(info->path));
R-type's avatar
R-type committed
640

641
642
   if (info && info->path)
      strncpy(RPATH, info->path, sizeof(RPATH) - 1);
R-type's avatar
R-type committed
643
644
645

   update_variables();

646
647
   retro_init_time();

R-type's avatar
R-type committed
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
   app_init();

   memset(SNDBUF,0,1024*2*2);

   return true;
}

void retro_unload_game(void){

   pauseg=-1;
}

unsigned retro_get_region(void)
{
   return RETRO_REGION_NTSC;
}

bool retro_load_game_special(unsigned type, const struct retro_game_info *info, size_t num)
{
   (void)type;
   (void)info;
   (void)num;
   return false;
}

size_t retro_serialize_size(void)
{
   return 0;
}

bool retro_serialize(void *data_, size_t size)
{
   return false;
}

bool retro_unserialize(const void *data_, size_t size)
{
   return false;
}

void *retro_get_memory_data(unsigned id)
{
   (void)id;
   return NULL;
}

size_t retro_get_memory_size(unsigned id)
{
   (void)id;
   return 0;
}

void retro_cheat_reset(void) {}

void retro_cheat_set(unsigned index, bool enabled, const char *code)
{
   (void)index;
   (void)enabled;
   (void)code;
}