mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-23 11:45:27 +00:00
Use CORE_CTL_* callbacks
This commit is contained in:
parent
957bf3f60c
commit
2542e4a04e
@ -37,6 +37,7 @@
|
||||
|
||||
#include "../video_shader_driver.h"
|
||||
#include "../video_shader_parse.h"
|
||||
#include "../../libretro_version_1.h"
|
||||
#include "../../dynamic.h"
|
||||
#include "../../rewind.h"
|
||||
#include "../video_state_tracker.h"
|
||||
@ -610,6 +611,7 @@ static bool gl_cg_load_plain(void *data, const char *path)
|
||||
static bool gl_cg_load_imports(void *data)
|
||||
{
|
||||
unsigned i;
|
||||
retro_ctx_memory_info_t mem_info;
|
||||
struct state_tracker_info tracker_info = {0};
|
||||
cg_shader_data_t *cg_data = (cg_shader_data_t*)data;
|
||||
|
||||
@ -619,6 +621,7 @@ static bool gl_cg_load_imports(void *data)
|
||||
for (i = 0; i < cg_data->shader->variables; i++)
|
||||
{
|
||||
unsigned memtype;
|
||||
|
||||
switch (cg_data->shader->variable[i].ram_type)
|
||||
{
|
||||
case RARCH_STATE_WRAM:
|
||||
@ -629,16 +632,25 @@ static bool gl_cg_load_imports(void *data)
|
||||
memtype = -1u;
|
||||
}
|
||||
|
||||
mem_info.id = memtype;
|
||||
|
||||
core_ctl(CORE_CTL_RETRO_GET_MEMORY, &mem_info);
|
||||
|
||||
if ((memtype != -1u) &&
|
||||
(cg_data->shader->variable[i].addr >= core.retro_get_memory_size(memtype)))
|
||||
(cg_data->shader->variable[i].addr >= mem_info.size))
|
||||
{
|
||||
RARCH_ERR("Address out of bounds.\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
tracker_info.wram = (uint8_t*)
|
||||
core.retro_get_memory_data(RETRO_MEMORY_SYSTEM_RAM);
|
||||
mem_info.data = NULL;
|
||||
mem_info.size = 0;
|
||||
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 = cg_data->shader->variable;
|
||||
tracker_info.info_elem = cg_data->shader->variables;
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "../../dynamic.h"
|
||||
#include "../../file_ops.h"
|
||||
#include "../../rewind.h"
|
||||
#include "../../libretro_version_1.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../../config.h"
|
||||
@ -878,9 +879,14 @@ static void *gl_glsl_init(void *data, const char *path)
|
||||
|
||||
if (glsl->shader->variables)
|
||||
{
|
||||
retro_ctx_memory_info_t mem_info;
|
||||
struct state_tracker_info info = {0};
|
||||
|
||||
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);
|
||||
|
||||
info.wram = (uint8_t*)mem_info.data;
|
||||
info.info = glsl->shader->variable;
|
||||
info.info_elem = glsl->shader->variables;
|
||||
|
||||
|
@ -190,16 +190,20 @@ uint32_t np_impl_magic(void)
|
||||
bool np_send_info(netplay_t *netplay)
|
||||
{
|
||||
unsigned sram_size;
|
||||
retro_ctx_memory_info_t mem_info;
|
||||
char msg[512] = {0};
|
||||
uint32_t *content_crc_ptr = NULL;
|
||||
void *sram = NULL;
|
||||
uint32_t header[3] = {0};
|
||||
|
||||
mem_info.id = RETRO_MEMORY_SAVE_RAM;
|
||||
|
||||
core_ctl(CORE_CTL_RETRO_GET_MEMORY, &mem_info);
|
||||
content_ctl(CONTENT_CTL_GET_CRC, &content_crc_ptr);
|
||||
|
||||
header[0] = htonl(*content_crc_ptr);
|
||||
header[1] = htonl(np_impl_magic());
|
||||
header[2] = htonl(core.retro_get_memory_size(RETRO_MEMORY_SAVE_RAM));
|
||||
header[2] = htonl(mem_info.size);
|
||||
|
||||
if (!socket_send_all_blocking(netplay->fd, header, sizeof(header)))
|
||||
return false;
|
||||
@ -211,8 +215,8 @@ bool np_send_info(netplay_t *netplay)
|
||||
}
|
||||
|
||||
/* Get SRAM data from User 1. */
|
||||
sram = core.retro_get_memory_data(RETRO_MEMORY_SAVE_RAM);
|
||||
sram_size = core.retro_get_memory_size(RETRO_MEMORY_SAVE_RAM);
|
||||
sram = mem_info.data;
|
||||
sram_size = mem_info.size;
|
||||
|
||||
if (!socket_receive_all_blocking(netplay->fd, sram, sram_size))
|
||||
{
|
||||
@ -237,6 +241,7 @@ bool np_get_info(netplay_t *netplay)
|
||||
{
|
||||
unsigned sram_size;
|
||||
uint32_t header[3];
|
||||
retro_ctx_memory_info_t mem_info;
|
||||
uint32_t *content_crc_ptr = NULL;
|
||||
const void *sram = NULL;
|
||||
|
||||
@ -260,7 +265,11 @@ bool np_get_info(netplay_t *netplay)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (core.retro_get_memory_size(RETRO_MEMORY_SAVE_RAM) != ntohl(header[2]))
|
||||
mem_info.id = RETRO_MEMORY_SAVE_RAM;
|
||||
|
||||
core_ctl(CORE_CTL_RETRO_GET_MEMORY, &mem_info);
|
||||
|
||||
if (mem_info.size != ntohl(header[2]))
|
||||
{
|
||||
RARCH_ERR("Content SRAM sizes do not correspond.\n");
|
||||
return false;
|
||||
@ -273,8 +282,8 @@ bool np_get_info(netplay_t *netplay)
|
||||
}
|
||||
|
||||
/* Send SRAM data to our User 2. */
|
||||
sram = core.retro_get_memory_data(RETRO_MEMORY_SAVE_RAM);
|
||||
sram_size = core.retro_get_memory_size(RETRO_MEMORY_SAVE_RAM);
|
||||
sram = mem_info.data;
|
||||
sram_size = mem_info.size;
|
||||
|
||||
if (!socket_send_all_blocking(netplay->fd, sram, sram_size))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user