Skip to content

Commit

Permalink
Use core callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Jan 28, 2016
1 parent 7f81d7a commit eb9be64
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
8 changes: 6 additions & 2 deletions gfx/d3d/d3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ static bool d3d_init_luts(d3d_video_t *d3d)
#ifndef DONT_HAVE_STATE_TRACKER
static bool d3d_init_imports(d3d_video_t *d3d)
{
retro_ctx_memory_info_t mem_info;
state_tracker_t *state_tracker = NULL;
state_tracker_info tracker_info = {0};

Expand All @@ -99,8 +100,11 @@ static bool d3d_init_imports(d3d_video_t *d3d)
if (!d3d->renderchain_driver->add_state_tracker)
return true;

tracker_info.wram = (uint8_t*)
core.retro_get_memory_data(RETRO_MEMORY_SYSTEM_RAM);
mem_info.id = RETRO_MEMORY_SYSTEM_RAM;

core_ctl(CORE_CTL_RETRO_GET_MEMORY, &mem_info);

tracker_info.wram = (uint8_t*)mem_info.data;
tracker_info.info = d3d->shader.variable;
tracker_info.info_elem = d3d->shader.variables;

Expand Down
25 changes: 19 additions & 6 deletions gfx/video_state_python.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "video_state_python.h"
#include "../dynamic.h"
#include "../libretro.h"
#include "../libretro_version_1.h"
#include "../general.h"
#include "../verbosity.h"
#include "../input/input_config.h"
Expand All @@ -34,8 +35,14 @@ static PyObject* py_read_wram(PyObject *self, PyObject *args)
{
unsigned addr;
size_t max;
const uint8_t *data = (const uint8_t*)
core.retro_get_memory_data(RETRO_MEMORY_SYSTEM_RAM);
retro_ctx_memory_info_t mem_info;
const uint8_t *data = NULL;

mem_info.id = RETRO_MEMORY_SYSTEM_RAM;

core_ctl(CORE_CTL_RETRO_GET_MEMORY, &mem_info);

data = (const uint8_t*)mem_info.data;

(void)self;

Expand All @@ -45,7 +52,7 @@ static PyObject* py_read_wram(PyObject *self, PyObject *args)
return Py_None;
}

max = core.retro_get_memory_size(RETRO_MEMORY_SYSTEM_RAM);
max = mem_info.size;

if (!PyArg_ParseTuple(args, "I", &addr))
return NULL;
Expand All @@ -63,8 +70,14 @@ static PyObject* py_read_vram(PyObject *self, PyObject *args)
{
unsigned addr;
size_t max;
const uint8_t *data = (const uint8_t*)
core.retro_get_memory_data(RETRO_MEMORY_VIDEO_RAM);
retro_ctx_memory_info_t mem_info;
const uint8_t *data = NULL;

mem_info.id = RETRO_MEMORY_VIDEO_RAM;

core_ctl(CORE_CTL_RETRO_GET_MEMORY, &mem_info);

data = (const uint8_t*)mem_info.data;

(void)self;

Expand All @@ -74,7 +87,7 @@ static PyObject* py_read_vram(PyObject *self, PyObject *args)
return Py_None;
}

max = core.retro_get_memory_size(RETRO_MEMORY_VIDEO_RAM);
max = mem_info.size;

if (!PyArg_ParseTuple(args, "I", &addr))
return NULL;
Expand Down

0 comments on commit eb9be64

Please sign in to comment.