From b4d2281f7d6be990807256a2385a7ead6b881d7c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 6 Jun 2019 13:12:38 +0200 Subject: [PATCH] command_write_ram - cleanup --- command.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/command.c b/command.c index b1fdaebcce..17c3b4da58 100755 --- a/command.c +++ b/command.c @@ -324,23 +324,18 @@ static bool command_read_ram(const char *arg) static bool command_write_ram(const char *arg) { unsigned nbytes = 0; - uint8_t *data = NULL; - unsigned int addr = 0; + unsigned int addr = strtoul(arg, (char**)&arg, 16); + uint8_t *data = (uint8_t *)rcheevos_patch_address(addr, rcheevos_get_console()); - addr = strtoul(arg, (char**)&arg, 16); - data = (uint8_t *)rcheevos_patch_address(addr, rcheevos_get_console()); + if (!data) + return false; - if (data) + while (*arg) { - while (*arg) - { - *data = strtoul(arg, (char**)&arg, 16); - data++; - } - return true; + *data = strtoul(arg, (char**)&arg, 16); + data++; } - - return false; + return true; } #endif