Fix segaboot
This commit is contained in:
parent
c083a0cf2c
commit
c33f488784
@ -1,6 +1,11 @@
|
||||
# SEGA Lindbergh Emulator Configuration File
|
||||
# Written by Bobby Dilley
|
||||
|
||||
|
||||
# Set the colour of the lindbergh to change the Segaboot logo
|
||||
# Possibly colours are: YELLOW and RED
|
||||
LINDBERGH_COLOUR YELLOW
|
||||
|
||||
# Choice of resolutions
|
||||
# 640 x 480
|
||||
# 800 x 600
|
||||
|
@ -132,6 +132,14 @@ int readConfig(FILE *configFile, EmulatorConfig *config)
|
||||
else if (strcmp(command, "JVS_PATH") == 0)
|
||||
strcpy(config->jvsPath, getNextToken(NULL, " ", &saveptr));
|
||||
|
||||
else if (strcmp(command, "LINDBERGH_COLOUR") == 0)
|
||||
{
|
||||
char colour[256];
|
||||
strcpy(colour, getNextToken(NULL, " ", &saveptr));
|
||||
if (strcmp(colour, "RED") == 0)
|
||||
config->lindberghColour = RED;
|
||||
}
|
||||
|
||||
else
|
||||
printf("Error: Unknown settings command %s\n", command);
|
||||
}
|
||||
@ -146,6 +154,7 @@ int initConfig()
|
||||
config.emulateMotionboard = 0;
|
||||
config.emulateJVS = 1;
|
||||
config.fullscreen = 0;
|
||||
config.lindberghColour = YELLOW;
|
||||
strcpy(config.eepromPath, "eeprom.bin");
|
||||
strcpy(config.sramPath, "sram.bin");
|
||||
strcpy(config.jvsPath, "none");
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#define MAX_PATH_LENGTH 1024
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
UNKNOWN,
|
||||
SEGABOOT,
|
||||
SEGABOOT_2_4,
|
||||
@ -12,6 +13,12 @@ typedef enum {
|
||||
LETS_GO_JUNGLE
|
||||
} Game;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
YELLOW,
|
||||
RED
|
||||
} Colour;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int emulateRideboard;
|
||||
@ -28,11 +35,9 @@ typedef struct
|
||||
int width;
|
||||
int height;
|
||||
Game game;
|
||||
Colour lindberghColour;
|
||||
} EmulatorConfig;
|
||||
|
||||
int initConfig();
|
||||
EmulatorConfig *getConfig();
|
||||
char *getGameName();
|
||||
|
||||
|
||||
|
||||
|
@ -17,8 +17,8 @@ int gameModeHeight = -1;
|
||||
|
||||
void *glutMainLoopThread()
|
||||
{
|
||||
glutMainLoop();
|
||||
return NULL;
|
||||
glutMainLoop();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FGAPI int FGAPIENTRY glutEnterGameMode()
|
||||
@ -29,8 +29,11 @@ FGAPI int FGAPIENTRY glutEnterGameMode()
|
||||
glutCreateWindow(gameTitle);
|
||||
|
||||
// Outrun doesn't run the glutMainLoop through, so we'll do that here
|
||||
pthread_t glutMainLoopID;
|
||||
pthread_create(&glutMainLoopID, NULL, &glutMainLoopThread, NULL);
|
||||
if (getConfig()->game == OUTRUN)
|
||||
{
|
||||
pthread_t glutMainLoopID;
|
||||
pthread_create(&glutMainLoopID, NULL, &glutMainLoopThread, NULL);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ int open(const char *pathname, int flags)
|
||||
{
|
||||
int (*_open)(const char *pathname, int flags) = dlsym(RTLD_NEXT, "open");
|
||||
|
||||
//printf("Open %s\n", pathname);
|
||||
// printf("Open %s\n", pathname);
|
||||
|
||||
if (strcmp(pathname, "/dev/lbb") == 0)
|
||||
{
|
||||
@ -190,7 +190,7 @@ int open(const char *pathname, int flags)
|
||||
FILE *fopen(const char *restrict pathname, const char *restrict mode)
|
||||
{
|
||||
FILE *(*_fopen)(const char *restrict pathname, const char *restrict mode) = dlsym(RTLD_NEXT, "fopen");
|
||||
//printf("fopen %s\n", pathname);
|
||||
// printf("fopen %s\n", pathname);
|
||||
|
||||
if (strcmp(pathname, "/root/lindbergrc") == 0)
|
||||
{
|
||||
@ -210,7 +210,7 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
|
||||
FILE *fopen64(const char *pathname, const char *mode)
|
||||
{
|
||||
FILE *(*_fopen64)(const char *restrict pathname, const char *restrict mode) = dlsym(RTLD_NEXT, "fopen64");
|
||||
//printf("fopen64 %s\n", pathname);
|
||||
// printf("fopen64 %s\n", pathname);
|
||||
|
||||
if (strcmp(pathname, "/proc/sys/kernel/osrelease") == 0)
|
||||
{
|
||||
@ -227,7 +227,7 @@ FILE *fopen64(const char *pathname, const char *mode)
|
||||
int openat(int dirfd, const char *pathname, int flags)
|
||||
{
|
||||
int (*_openat)(int dirfd, const char *pathname, int flags) = dlsym(RTLD_NEXT, "openat");
|
||||
//printf("openat %s\n", pathname);
|
||||
// printf("openat %s\n", pathname);
|
||||
|
||||
if (strcmp(pathname, "/dev/ttyS0") == 0 || strcmp(pathname, "/dev/ttyS1") == 0 || strcmp(pathname, "/dev/tts/0") == 0 || strcmp(pathname, "/dev/tts/1") == 0)
|
||||
{
|
||||
@ -267,14 +267,21 @@ char *fgets(char *str, int n, FILE *stream)
|
||||
// This currently doesn't work
|
||||
if (stream == fileHooks[CPUINFO])
|
||||
{
|
||||
char *contents = "model name\t: Intel(R) Celeron(R) CPU 3.00GHz\n";
|
||||
strcpy(str, contents);
|
||||
char contents[4][256];
|
||||
|
||||
if(!fileRead[CPUINFO])
|
||||
return str;
|
||||
strcpy(contents[0], "processor : 0");
|
||||
strcpy(contents[1], "vendor_id : GenuineIntel");
|
||||
strcpy(contents[2], "model : 142");
|
||||
strcpy(contents[3], "model name : Intel(R) Pentium(R) CPU 3.00GHz");
|
||||
|
||||
fileRead[CPUINFO] = 1;
|
||||
return NULL;
|
||||
if (getConfig()->lindberghColour == RED)
|
||||
strcpy(contents[3], "model name : Intel(R) Celeron(R) CPU 3.00GHz");
|
||||
|
||||
if (fileRead[CPUINFO] == 4)
|
||||
return NULL;
|
||||
|
||||
strcpy(str, contents[fileRead[CPUINFO]++]);
|
||||
return str;
|
||||
}
|
||||
|
||||
return _fgets(str, n, stream);
|
||||
@ -447,11 +454,10 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
|
||||
{
|
||||
int (*_connect)(int sockfd, const struct sockaddr *addr, socklen_t addrlen) = dlsym(RTLD_NEXT, "connect");
|
||||
|
||||
|
||||
struct sockaddr_in *in_pointer = (struct sockaddr_in *)addr;
|
||||
|
||||
// Change the IP to connect to to 127.0.0.1
|
||||
//in_pointer->sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
// in_pointer->sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
char *some_addr = inet_ntoa(in_pointer->sin_addr);
|
||||
printf("Connecting to %s\n", some_addr);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user