Commit 2cf40232 authored by frangarcj's avatar frangarcj
Browse files

DRZ80 + Logger

parent deb11f4f
......@@ -11,7 +11,7 @@
//
#ifndef __GP32__
#include "stdafx.h"
#include "StdAfx.h"
#endif
#include "main.h"
#include "memory.h"
......
......@@ -36,10 +36,14 @@ SOURCES_CXX := $(CORE_DIR)/input.cpp \
$(CORE_DIR)/main.cpp \
$(CORE_DIR)/state.cpp \
$(CORE_DIR)/sound.cpp \
$(CORE_DIR)/libretro/libretro.cpp
$(CORE_DIR)/libretro/libretro.cpp \
$(CORE_DIR)/libretro/log.cpp
ifeq ($(DRZ80),1)
FLAGS += -DDRZ80
SOURCES_CXX += $(CORE_DIR)/DrZ80_support.cpp
SOURCES_ASM := $(CORE_DIR)/DrZ80.s
else
FLAGS += -DCZ80
SOURCES_CXX += $(CORE_DIR)/cz80.cpp \
......
#include "libretro.h"
#include "log.h"
#include <string.h>
#include <fstream>
......@@ -137,10 +138,8 @@ static void check_variables(void)
}
void retro_init(void)
{
struct retro_log_callback log;
environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log);
if (log.log)
log_cb = log.log;
/* set up some logging */
init_log(environ_cb);
check_variables();
......@@ -250,8 +249,10 @@ static bool race_initialize_system(const char* gamepath)
{
mainemuinit();
if(!handleInputFile((char *)gamepath))
return false;
if(!handleInputFile((char *)gamepath)){
handle_error("ERROR handleInputFile");
return false;
}
return true;
}
......
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "libretro.h"
static retro_log_printf_t log_cb;
void init_log(retro_environment_t environ_cb)
{
struct retro_log_callback log;
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
log_cb = log.log;
else
log_cb = NULL;
}
void handle_error( const char* error )
{
char str [256];
if(error) {
sprintf( str, "Error: %s", error );
log_cb(RETRO_LOG_ERROR, str );
}
}
void handle_info( const char* info )
{
char str [256];
if(info) {
sprintf( str, "Info: %s\n", info );
log_cb(RETRO_LOG_INFO, str );
}
}
\ No newline at end of file
#ifndef RACE_LIBRETRO_LOG_H__
#define RACE_LIBRETRO_LOG_H__
#include "libretro.h"
void init_log(retro_environment_t environ_cb);
void handle_error( const char* error );
void handle_info( const char* info );
#endif
\ No newline at end of file
......@@ -83,8 +83,10 @@ void mainemuinit()
// initialize the TLCS-900H cpu
tlcs_init();
#if defined(DRZ80) || defined(CZ80)
#if defined(CZ80)
Z80_Init();
#endif
#if defined(DRZ80) || defined(CZ80)
Z80_Reset();
#else
z80Init();
......
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