mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +00:00
Roll this back
This commit is contained in:
parent
9097727452
commit
ee24cfce31
66
content.c
66
content.c
@ -898,51 +898,6 @@ error:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool read_content_stdin(struct retro_game_info *info)
|
|
||||||
{
|
|
||||||
size_t buf_size;
|
|
||||||
size_t buf_ptr;
|
|
||||||
uint8_t *rom_buf = NULL;
|
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_XBOX)
|
|
||||||
_setmode(0, O_BINARY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RARCH_LOG("Reading content from stdin ...\n");
|
|
||||||
buf_size = 0xfffff; /* Some initial guesstimate. */
|
|
||||||
buf_ptr = 0;
|
|
||||||
rom_buf = (uint8_t*)malloc(buf_size);
|
|
||||||
|
|
||||||
if (!rom_buf)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
size_t ret = fread(rom_buf + buf_ptr, 1,
|
|
||||||
buf_size - buf_ptr, stdin);
|
|
||||||
buf_ptr += ret;
|
|
||||||
|
|
||||||
/* We've reached the end */
|
|
||||||
if (buf_ptr < buf_size)
|
|
||||||
break;
|
|
||||||
|
|
||||||
rom_buf = (uint8_t*)realloc(rom_buf, buf_size * 2);
|
|
||||||
if (!rom_buf)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
buf_size *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->data = &rom_buf;
|
|
||||||
info->size = buf_ptr;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
error:
|
|
||||||
RARCH_ERR("Couldn't allocate memory.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read_content_file:
|
* read_content_file:
|
||||||
* @path : buffer of the content file.
|
* @path : buffer of the content file.
|
||||||
@ -965,12 +920,10 @@ static bool read_content_file(unsigned i, const char *path, void **buf,
|
|||||||
uint8_t *ret_buf = NULL;
|
uint8_t *ret_buf = NULL;
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
{
|
RARCH_LOG("%s: %s.\n",
|
||||||
RARCH_LOG("%s: %s.\n",
|
msg_hash_to_str(MSG_LOADING_CONTENT_FILE), path);
|
||||||
msg_hash_to_str(MSG_LOADING_CONTENT_FILE), path);
|
if (!content_file_read(path, (void**) &ret_buf, length))
|
||||||
if (!content_file_read(path, (void**) &ret_buf, length))
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*length < 0)
|
if (*length < 0)
|
||||||
return false;
|
return false;
|
||||||
@ -1430,8 +1383,7 @@ static bool load_content(
|
|||||||
bool require_content = attr & 4;
|
bool require_content = attr & 4;
|
||||||
const char *path = content->elems[i].data;
|
const char *path = content->elems[i].data;
|
||||||
|
|
||||||
if (require_content && string_is_empty(path) &&
|
if (require_content && string_is_empty(path))
|
||||||
!content_ctl(RARCH_CTL_IS_STDIN_CLAIMED, NULL))
|
|
||||||
{
|
{
|
||||||
RARCH_LOG("libretro core requires content, "
|
RARCH_LOG("libretro core requires content, "
|
||||||
"but nothing was provided.\n");
|
"but nothing was provided.\n");
|
||||||
@ -1443,14 +1395,6 @@ static bool load_content(
|
|||||||
if (*path)
|
if (*path)
|
||||||
info[i].path = path;
|
info[i].path = path;
|
||||||
|
|
||||||
if (!need_fullpath &&
|
|
||||||
content_ctl(RARCH_CTL_IS_STDIN_CLAIMED, NULL))
|
|
||||||
{
|
|
||||||
if (read_content_stdin(&info[0]))
|
|
||||||
break;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (!need_fullpath && !string_is_empty(path))
|
if (!need_fullpath && !string_is_empty(path))
|
||||||
{
|
{
|
||||||
if (!load_content_into_memory(&info[i], i, path))
|
if (!load_content_into_memory(&info[i], i, path))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user