From 0c6809952d400d7b9eb976ac6203051914d933f2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 2 Jul 2015 00:56:51 +0200 Subject: [PATCH] Cleanups --- database_info.c | 6 +++--- patch.c | 7 +++++-- runloop.c | 3 +-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/database_info.c b/database_info.c index 881ae88046..681de31123 100644 --- a/database_info.c +++ b/database_info.c @@ -16,13 +16,13 @@ */ #include -#include #include "file_ext.h" #include "dir_list_special.h" #include "database_info.h" #include "file_ops.h" +#include "msg_hash.h" #include "general.h" #include "runloop.h" @@ -117,7 +117,7 @@ int database_info_build_query(char *s, size_t len, database_info_build_query_add_bracket_open(s, len); - value = djb2_calculate(label); + value = msg_hash_calculate(label); switch (value) { @@ -247,7 +247,7 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur, continue; str = key->val.string.buff; - value = djb2_calculate(str); + value = msg_hash_calculate(str); switch (value) { diff --git a/patch.c b/patch.c index 4d70158124..481fcf2a8f 100644 --- a/patch.c +++ b/patch.c @@ -148,9 +148,11 @@ patch_error_t bps_apply_patch( case SOURCE_COPY: case TARGET_COPY: { - int offset = bps_decode(&bps); + int offset = bps_decode(&bps); bool negative = offset & 1; + offset >>= 1; + if (negative) offset = -offset; @@ -257,7 +259,8 @@ static uint64_t ups_decode(struct ups_data *data) while (true) { uint8_t x = ups_patch_read(data); - offset += (x & 0x7f) * shift; + offset += (x & 0x7f) * shift; + if (x & 0x80) break; shift <<= 7; diff --git a/runloop.c b/runloop.c index acba7e438f..81d7cd22c5 100644 --- a/runloop.c +++ b/runloop.c @@ -21,7 +21,6 @@ #include #include -#include #include "configuration.h" #include "dynamic.h" @@ -400,7 +399,7 @@ static void check_shader_dir(bool pressed_next, bool pressed_prev) shader = global->shader_dir.list->elems[global->shader_dir.ptr].data; ext = path_get_extension(shader); - ext_hash = djb2_calculate(ext); + ext_hash = msg_hash_calculate(ext); switch (ext_hash) {