Silence warnings
This commit is contained in:
parent
9267771422
commit
afd73998e6
34
ai/game_ai.c
34
ai/game_ai.c
|
@ -11,6 +11,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <retro_assert.h>
|
#include <retro_assert.h>
|
||||||
|
#include <compat/strl.h>
|
||||||
|
|
||||||
#include "../deps/game_ai_lib/GameAI.h"
|
#include "../deps/game_ai_lib/GameAI.h"
|
||||||
|
|
||||||
|
@ -51,30 +52,25 @@ void game_ai_debug_log(int level, const char *fmt, ...)
|
||||||
va_end(vp);
|
va_end(vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void array_to_bits_16(volatile signed short * result, const bool b[16])
|
void array_to_bits_16(volatile signed short *result, const bool b[16])
|
||||||
{
|
{
|
||||||
for (int bit = 0; bit <= 15; bit++)
|
for (int bit = 0; bit <= 15; bit++)
|
||||||
{
|
|
||||||
*result |= b[bit] ? (1 << bit) : 0;
|
*result |= b[bit] ? (1 << bit) : 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interface to RA */
|
/* Interface to RA */
|
||||||
|
|
||||||
extern signed short int game_ai_input(unsigned int port, unsigned int device, unsigned int idx, unsigned int id, signed short int result)
|
signed short int game_ai_input(unsigned int port, unsigned int device,
|
||||||
|
unsigned int idx, unsigned int id, signed short int result)
|
||||||
{
|
{
|
||||||
if (ga == NULL)
|
if (ga && (port < GAME_AI_MAX_PLAYERS))
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (port < GAME_AI_MAX_PLAYERS)
|
|
||||||
return g_buttons_bits[port];
|
return g_buttons_bits[port];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void game_ai_init()
|
void game_ai_init(void)
|
||||||
{
|
{
|
||||||
if (create_game_ai == NULL)
|
if (!create_game_ai)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
|
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
|
||||||
|
@ -85,7 +81,7 @@ extern void game_ai_init()
|
||||||
char full_module_path[MAX_PATH];
|
char full_module_path[MAX_PATH];
|
||||||
DWORD dwLen = GetModuleFileNameA(g_lib_handle, static_cast<char*>(&full_module_path), MAX_PATH);
|
DWORD dwLen = GetModuleFileNameA(g_lib_handle, static_cast<char*>(&full_module_path), MAX_PATH);
|
||||||
|
|
||||||
if (hinstLib != NULL)
|
if (hinstLib)
|
||||||
{
|
{
|
||||||
create_game_ai = (create_game_ai_t) GetProcAddress(hinstLib, "create_game_ai");
|
create_game_ai = (create_game_ai_t) GetProcAddress(hinstLib, "create_game_ai");
|
||||||
retro_assert(create_game_ai);
|
retro_assert(create_game_ai);
|
||||||
|
@ -109,7 +105,7 @@ extern void game_ai_init()
|
||||||
g_lib_handle = dlopen("./libgame_ai.so", RTLD_NOW);
|
g_lib_handle = dlopen("./libgame_ai.so", RTLD_NOW);
|
||||||
retro_assert(g_lib_handle);
|
retro_assert(g_lib_handle);
|
||||||
|
|
||||||
if(g_lib_handle != NULL)
|
if (g_lib_handle)
|
||||||
{
|
{
|
||||||
dlinfo(g_lib_handle, RTLD_DI_ORIGIN, (void *) &game_ai_lib_path);
|
dlinfo(g_lib_handle, RTLD_DI_ORIGIN, (void *) &game_ai_lib_path);
|
||||||
|
|
||||||
|
@ -135,7 +131,7 @@ extern void game_ai_init()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void game_ai_shutdown()
|
void game_ai_shutdown(void)
|
||||||
{
|
{
|
||||||
if (g_lib_handle)
|
if (g_lib_handle)
|
||||||
{
|
{
|
||||||
|
@ -152,7 +148,7 @@ extern void game_ai_shutdown()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void game_ai_load(const char * name, void * ram_ptr, int ram_size, retro_log_printf_t log)
|
void game_ai_load(const char * name, void * ram_ptr, int ram_size, retro_log_printf_t log)
|
||||||
{
|
{
|
||||||
strcpy((char *) &g_game_name[0], name);
|
strcpy((char *) &g_game_name[0], name);
|
||||||
|
|
||||||
|
@ -168,12 +164,14 @@ extern void game_ai_load(const char * name, void * ram_ptr, int ram_size, retro_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void game_ai_think(bool override_p1, bool override_p2, bool show_debug, const void *frame_data, unsigned int frame_width, unsigned int frame_height, unsigned int frame_pitch, unsigned int pixel_format)
|
void game_ai_think(bool override_p1, bool override_p2, bool show_debug,
|
||||||
|
const void *frame_data, unsigned int frame_width, unsigned int frame_height,
|
||||||
|
unsigned int frame_pitch, unsigned int pixel_format)
|
||||||
{
|
{
|
||||||
if (ga)
|
if (ga)
|
||||||
game_ai_lib_set_show_debug(ga, show_debug);
|
game_ai_lib_set_show_debug(ga, show_debug);
|
||||||
|
|
||||||
if (ga == NULL && g_ram_ptr != NULL)
|
if (!ga && g_ram_ptr)
|
||||||
{
|
{
|
||||||
ga = create_game_ai((char *) &g_game_name[0]);
|
ga = create_game_ai((char *) &g_game_name[0]);
|
||||||
retro_assert(ga);
|
retro_assert(ga);
|
||||||
|
@ -214,7 +212,5 @@ extern void game_ai_think(bool override_p1, bool override_p2, bool show_debug, c
|
||||||
g_frameCount=0;
|
g_frameCount=0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
g_frameCount++;
|
g_frameCount++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
47
ai/game_ai.h
47
ai/game_ai.h
|
@ -1,9 +1,44 @@
|
||||||
#pragma once
|
/* RetroArch - A frontend for libretro.
|
||||||
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||||
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
||||||
|
* Copyright (C) 2021 - David G.F.
|
||||||
|
*
|
||||||
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||||
|
* of the GNU General Public License as published by the Free Software Found-
|
||||||
|
* ation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||||
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RARCH_GAME_AI_H__
|
||||||
|
#define RARCH_GAME_AI_H__
|
||||||
|
|
||||||
|
#include <boolean.h>
|
||||||
|
#include <retro_common_api.h>
|
||||||
|
|
||||||
#include <libretro.h>
|
#include <libretro.h>
|
||||||
|
|
||||||
signed short int game_ai_input(unsigned int port, unsigned int device, unsigned int idx, unsigned int id, signed short int result);
|
RETRO_BEGIN_DECLS
|
||||||
void game_ai_init();
|
|
||||||
void game_ai_shutdown();
|
signed short int game_ai_input(unsigned int port, unsigned int device,
|
||||||
void game_ai_load(const char * name, void * ram_ptr, int ram_size, retro_log_printf_t log);
|
unsigned int idx, unsigned int id, signed short int result);
|
||||||
void game_ai_think(bool override_p1, bool override_p2, bool show_debug, const void *frame_data, unsigned int frame_width, unsigned int frame_height, unsigned int frame_pitch, unsigned int pixel_format);
|
|
||||||
|
void game_ai_init(void);
|
||||||
|
|
||||||
|
void game_ai_shutdown(void);
|
||||||
|
|
||||||
|
void game_ai_load(const char * name, void * ram_ptr,
|
||||||
|
int ram_size, retro_log_printf_t log);
|
||||||
|
|
||||||
|
void game_ai_think(bool override_p1, bool override_p2, bool show_debug,
|
||||||
|
const void *frame_data, unsigned int frame_w, unsigned int frame_h,
|
||||||
|
unsigned int frame_pitch, unsigned int pixel_format);
|
||||||
|
|
||||||
|
RETRO_END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -9372,7 +9372,7 @@ static enum menu_action materialui_parse_menu_entry_action(
|
||||||
struct menu_state *menu_st = menu_state_get_ptr();
|
struct menu_state *menu_st = menu_state_get_ptr();
|
||||||
size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
||||||
size_t selection = menu_st->selection_ptr;
|
size_t selection = menu_st->selection_ptr;
|
||||||
size_t new_selection = random_range(0, selection_total - 1);
|
size_t new_selection = random_range(0, (unsigned)(selection_total - 1));
|
||||||
menu_entry_t entry_new;
|
menu_entry_t entry_new;
|
||||||
|
|
||||||
MENU_ENTRY_INITIALIZE(entry_new);
|
MENU_ENTRY_INITIALIZE(entry_new);
|
||||||
|
@ -9380,7 +9380,7 @@ static enum menu_action materialui_parse_menu_entry_action(
|
||||||
/* Keep randomizing until selection is a fresh playlist */
|
/* Keep randomizing until selection is a fresh playlist */
|
||||||
while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION)
|
while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION)
|
||||||
{
|
{
|
||||||
new_selection = random_range(0, selection_total - 1);
|
new_selection = random_range(0, (unsigned)(selection_total - 1));
|
||||||
menu_entry_get(&entry_new, 0, new_selection, NULL, false);
|
menu_entry_get(&entry_new, 0, new_selection, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8154,9 +8154,9 @@ static enum menu_action ozone_parse_menu_entry_action(
|
||||||
? ozone_get_onscreen_category_selection(ozone)
|
? ozone_get_onscreen_category_selection(ozone)
|
||||||
: ozone->categories_selection_ptr;
|
: ozone->categories_selection_ptr;
|
||||||
|
|
||||||
new_selection = random_range(ozone->system_tab_end + 1, ozone->system_tab_end + horizontal_list_size);
|
new_selection = random_range(ozone->system_tab_end + 1, (unsigned)(ozone->system_tab_end + horizontal_list_size));
|
||||||
while (new_selection == (int)tab_selection)
|
while (new_selection == (int)tab_selection)
|
||||||
new_selection = random_range(ozone->system_tab_end + 1, ozone->system_tab_end + horizontal_list_size);
|
new_selection = random_range(ozone->system_tab_end + 1, (unsigned)(ozone->system_tab_end + horizontal_list_size));
|
||||||
|
|
||||||
if (new_selection != (int)tab_selection)
|
if (new_selection != (int)tab_selection)
|
||||||
ozone_sidebar_goto(ozone, new_selection);
|
ozone_sidebar_goto(ozone, new_selection);
|
||||||
|
@ -8175,7 +8175,7 @@ static enum menu_action ozone_parse_menu_entry_action(
|
||||||
struct menu_state *menu_st = menu_state_get_ptr();
|
struct menu_state *menu_st = menu_state_get_ptr();
|
||||||
size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
||||||
size_t selection = menu_st->selection_ptr;
|
size_t selection = menu_st->selection_ptr;
|
||||||
size_t new_selection = random_range(0, selection_total - 1);
|
size_t new_selection = random_range(0, (unsigned)(selection_total - 1));
|
||||||
menu_entry_t entry_new;
|
menu_entry_t entry_new;
|
||||||
|
|
||||||
MENU_ENTRY_INITIALIZE(entry_new);
|
MENU_ENTRY_INITIALIZE(entry_new);
|
||||||
|
@ -8183,7 +8183,7 @@ static enum menu_action ozone_parse_menu_entry_action(
|
||||||
/* Keep randomizing until selection is a fresh playlist */
|
/* Keep randomizing until selection is a fresh playlist */
|
||||||
while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION)
|
while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION)
|
||||||
{
|
{
|
||||||
new_selection = random_range(0, selection_total - 1);
|
new_selection = random_range(0, (unsigned)(selection_total - 1));
|
||||||
menu_entry_get(&entry_new, 0, new_selection, NULL, false);
|
menu_entry_get(&entry_new, 0, new_selection, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11654,7 +11654,6 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
|
||||||
bool video_fullscreen = video_info->fullscreen;
|
bool video_fullscreen = video_info->fullscreen;
|
||||||
bool mouse_grabbed = video_info->input_driver_grab_mouse_state;
|
bool mouse_grabbed = video_info->input_driver_grab_mouse_state;
|
||||||
bool menu_mouse_enable = video_info->menu_mouse_enable;
|
bool menu_mouse_enable = video_info->menu_mouse_enable;
|
||||||
bool input_menu_swap_ok_cancel_buttons = video_info->input_menu_swap_ok_cancel_buttons;
|
|
||||||
bool battery_level_enable = video_info->battery_level_enable;
|
bool battery_level_enable = video_info->battery_level_enable;
|
||||||
bool timedate_enable = video_info->timedate_enable;
|
bool timedate_enable = video_info->timedate_enable;
|
||||||
gfx_display_t *p_disp = (gfx_display_t*)video_info->disp_userdata;
|
gfx_display_t *p_disp = (gfx_display_t*)video_info->disp_userdata;
|
||||||
|
|
|
@ -8114,7 +8114,7 @@ static enum menu_action rgui_parse_menu_entry_action(
|
||||||
{
|
{
|
||||||
size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
||||||
size_t selection = menu_st->selection_ptr;
|
size_t selection = menu_st->selection_ptr;
|
||||||
size_t new_selection = random_range(0, selection_total - 1);
|
size_t new_selection = random_range(0, (unsigned)(selection_total - 1));
|
||||||
menu_entry_t entry_new;
|
menu_entry_t entry_new;
|
||||||
|
|
||||||
MENU_ENTRY_INITIALIZE(entry_new);
|
MENU_ENTRY_INITIALIZE(entry_new);
|
||||||
|
@ -8122,7 +8122,7 @@ static enum menu_action rgui_parse_menu_entry_action(
|
||||||
/* Keep randomizing until selection is a fresh playlist */
|
/* Keep randomizing until selection is a fresh playlist */
|
||||||
while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION)
|
while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION)
|
||||||
{
|
{
|
||||||
new_selection = random_range(0, selection_total - 1);
|
new_selection = random_range(0, (unsigned)(selection_total - 1));
|
||||||
menu_entry_get(&entry_new, 0, new_selection, NULL, false);
|
menu_entry_get(&entry_new, 0, new_selection, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5562,7 +5562,7 @@ static enum menu_action xmb_parse_menu_entry_action(
|
||||||
struct menu_state *menu_st = menu_state_get_ptr();
|
struct menu_state *menu_st = menu_state_get_ptr();
|
||||||
size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
size_t selection_total = menu_st->entries.list ? MENU_LIST_GET_SELECTION(menu_st->entries.list, 0)->size : 0;
|
||||||
size_t selection = menu_st->selection_ptr;
|
size_t selection = menu_st->selection_ptr;
|
||||||
size_t new_selection = random_range(0, selection_total - 1);
|
size_t new_selection = random_range(0, (unsigned)(selection_total - 1));
|
||||||
menu_entry_t entry_new;
|
menu_entry_t entry_new;
|
||||||
|
|
||||||
MENU_ENTRY_INITIALIZE(entry_new);
|
MENU_ENTRY_INITIALIZE(entry_new);
|
||||||
|
@ -5570,7 +5570,7 @@ static enum menu_action xmb_parse_menu_entry_action(
|
||||||
/* Keep randomizing until selection is a fresh playlist */
|
/* Keep randomizing until selection is a fresh playlist */
|
||||||
while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION)
|
while (new_selection == selection || entry_new.type != FILE_TYPE_PLAYLIST_COLLECTION)
|
||||||
{
|
{
|
||||||
new_selection = random_range(0, selection_total - 1);
|
new_selection = random_range(0, (unsigned)(selection_total - 1));
|
||||||
menu_entry_get(&entry_new, 0, new_selection, NULL, false);
|
menu_entry_get(&entry_new, 0, new_selection, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7914,9 +7914,7 @@ unsigned menu_displaylist_build_list(
|
||||||
case DISPLAYLIST_LOAD_CONTENT_LIST:
|
case DISPLAYLIST_LOAD_CONTENT_LIST:
|
||||||
case DISPLAYLIST_LOAD_CONTENT_SPECIAL:
|
case DISPLAYLIST_LOAD_CONTENT_SPECIAL:
|
||||||
{
|
{
|
||||||
const char *menu_ident = menu_driver_ident();
|
|
||||||
core_info_list_t *info_list = NULL;
|
core_info_list_t *info_list = NULL;
|
||||||
|
|
||||||
core_info_get_list(&info_list);
|
core_info_get_list(&info_list);
|
||||||
|
|
||||||
if (!string_is_empty(settings->paths.directory_menu_content))
|
if (!string_is_empty(settings->paths.directory_menu_content))
|
||||||
|
|
|
@ -8129,10 +8129,10 @@ size_t menu_playlist_random_selection(size_t selection, bool is_explore_list)
|
||||||
selection_start = 2;
|
selection_start = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_selection = random_range(selection_start, selection_total - 1);
|
new_selection = random_range(selection_start, (unsigned)(selection_total - 1));
|
||||||
|
|
||||||
while (new_selection == selection && selection_start != selection_total - 1)
|
while (new_selection == selection && selection_start != selection_total - 1)
|
||||||
new_selection = random_range(selection_start, selection_total - 1);
|
new_selection = random_range(selection_start, (unsigned)(selection_total - 1));
|
||||||
|
|
||||||
return new_selection;
|
return new_selection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1562,8 +1562,8 @@ static INLINE void preempt_input_poll(preempt_t *preempt,
|
||||||
for (p = 0; p < max_users; p++)
|
for (p = 0; p < max_users; p++)
|
||||||
{
|
{
|
||||||
/* Check full digital joypad */
|
/* Check full digital joypad */
|
||||||
joypad_state = state_cb(p, RETRO_DEVICE_JOYPAD,
|
joypad_state = (int16_t)(state_cb(p, RETRO_DEVICE_JOYPAD,
|
||||||
0, RETRO_DEVICE_ID_JOYPAD_MASK);
|
0, RETRO_DEVICE_ID_JOYPAD_MASK));
|
||||||
if (joypad_state != preempt->joypad_state[p])
|
if (joypad_state != preempt->joypad_state[p])
|
||||||
{
|
{
|
||||||
preempt->joypad_state[p] = joypad_state;
|
preempt->joypad_state[p] = joypad_state;
|
||||||
|
|
Loading…
Reference in New Issue