2014-12-17 18:13:05 +00:00
|
|
|
//
|
|
|
|
// ios_main.m
|
|
|
|
// emulator
|
|
|
|
//
|
|
|
|
// Created by admin on 12/17/14.
|
|
|
|
// Copyright (c) 2014 Karen Tsai (angelXwind). All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <poll.h>
|
|
|
|
#include <termios.h>
|
|
|
|
//#include <curses.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <semaphore.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include "hw/sh4/dyna/blockmanager.h"
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
|
|
int msgboxf(const wchar* text,unsigned int type,...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
wchar temp[2048];
|
|
|
|
va_start(args, type);
|
|
|
|
vsprintf(temp, text, args);
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
//printf(NULL,temp,VER_SHORTNAME,type | MB_TASKMODAL);
|
|
|
|
puts(temp);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-08-10 01:02:59 +00:00
|
|
|
int darw_printf(const wchar* text,...) {
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
wchar temp[2048];
|
|
|
|
va_start(args, text);
|
|
|
|
vsprintf(temp, text, args);
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
NSLog(@"%s", temp);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-17 18:13:05 +00:00
|
|
|
void common_linux_setup();
|
|
|
|
int dc_init(int argc,wchar* argv[]);
|
|
|
|
void dc_run();
|
|
|
|
|
|
|
|
u16 kcode[4];
|
|
|
|
u32 vks[4];
|
|
|
|
s8 joyx[4],joyy[4];
|
|
|
|
u8 rt[4],lt[4];
|
|
|
|
|
|
|
|
extern "C" int reicast_main(int argc, wchar* argv[])
|
|
|
|
{
|
|
|
|
//if (argc==2)
|
|
|
|
//ndcid=atoi(argv[1]);
|
|
|
|
|
|
|
|
string homedir = [ [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] objectAtIndex:0] path] UTF8String];
|
2015-08-22 19:49:12 +00:00
|
|
|
set_user_config_dir(homedir);
|
|
|
|
set_user_data_dir(homedir);
|
2014-12-17 18:13:05 +00:00
|
|
|
|
Partially working dyna for iOS. Very few games working atm.
This works, but is extremelly hacky. Must be started without attached debugger, lldb doesn't want to let go of EXC_BAD_ADDRESS, but reicast really depends on it getting delivered as SIGSEGV/SIGBUS. Also xcode has a really bad day upon seeing the jit code. Oh well.
There's some dynarec bug that causes color corruption on bios logo/boot triagles, TA crash on ikaruga and infinitive loop on crazy taxi. I'd guess some fp-memory-write thingy, abi, or smth. Too bad.
- Force code to compile in arm mode (arm jit -> thumb mem functions is complicated)
- SIGILL, SIGBUS. Works w/o Mach exceptions and EXC_BAD_ADDRESS
- Code buffers move to __TEXT, munmapped && memmapped to actually work
- Primitive input. Button + start, or left (works to get out of bios date screen)
- Fixup emitter for thumb2/interworking (didn't work though, reverted to arm cc)
- Block Manager: Disable mem saving / page fault alloc-on-demand logic
- Move cycle counter to r11, r9 is not clean on iOS. Remove r11 from reg alloc list
- Cache flushes for iOS
- log to log.txt
- load game.chd
2015-01-19 07:52:12 +00:00
|
|
|
freopen( (homedir + "/log.txt").c_str(), "wb", stdout);
|
|
|
|
|
2015-08-28 23:28:51 +00:00
|
|
|
printf("Config dir is: %s\n", get_writable_config_path("/").c_str());
|
|
|
|
printf("Data dir is: %s\n", get_writable_data_path("/").c_str());
|
2014-12-17 18:13:05 +00:00
|
|
|
|
|
|
|
common_linux_setup();
|
|
|
|
|
|
|
|
settings.profile.run_counts=0;
|
|
|
|
|
|
|
|
dc_init(argc,argv);
|
|
|
|
|
|
|
|
dc_run();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void os_DoEvents() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u32 os_Push(void*, u32, bool) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void os_SetWindowText(const char* t) {
|
|
|
|
puts(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
void os_CreateWindow() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void UpdateInputState(u32 port) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-12-08 00:27:19 +00:00
|
|
|
void UpdateVibration(u32 port, u32 value) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-12-17 18:13:05 +00:00
|
|
|
void get_mic_data(u8* ) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void* libPvr_GetRenderTarget() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void* libPvr_GetRenderSurface() {
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool gl_init(void*, void*) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gl_term() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void gl_swap() {
|
|
|
|
|
|
|
|
}
|