mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
* Add dummy game ai subsystem * First working prototype of a machine learning model that can override player input * Update README.md * Update README.md * Fix loading path on Windows * Change ai override to player 2 * Added quick menu show game ai option * Implemented Quick Menu entry for Game AI options * Redirect debug logs to retroarch log system + properly support player override * Added support to use framebuffer as input to the AI * Added pixel format parameter to API * Fix game name * code clean-up of game_ai.cpp * Update README.md - Windows Build * Update README.md * Update README.md * Update README.md * Update config.params.sh turn off GAME_AI feature by default * Fix compile error in menu_displaylist.c * Add missing #define in menu_cbs_title.c * Added new game_ai entry in griffin_cpp * Remove GAME_AI entry in msg_hash_us.c * Fix compile error in menu_displaylist.h * Removed GAME AI references from README.md * Fixes coding style + add GameAI lib API header * Convert comment to legacy + remove unused code * Additional coding style fixes to game_ai.cpp * Fix identation issues in game_ai.cpp * Removed some debug code in game_ai.cpp * Add game_ai_lib in deps * Replace assert with retro_assert * Update Makefile.common * Converting game_ai from cpp to c. First step. * Convert game_ai from CPP to C. STEP 2: add C function calls * Convert game_ai from CPP to C. Final Step * Added shutdown function for game ai lib * Update game_ai_lib README * Fix crash when loading/unloading multiple games
41 lines
1.4 KiB
C++
41 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#include <bitset>
|
|
#include <string>
|
|
#include <filesystem>
|
|
#include <vector>
|
|
#include <queue>
|
|
|
|
#endif
|
|
|
|
|
|
typedef void (*debug_log_t)(int level, const char *fmt, ...);
|
|
|
|
#define GAMEAI_MAX_BUTTONS 16
|
|
#define GAMEAI_SKIPFRAMES 4
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
class GameAI {
|
|
public:
|
|
virtual void Init(void * ram_ptr, int ram_size) {};
|
|
virtual void Think(bool buttons[GAMEAI_MAX_BUTTONS], int player, const void *frame_data, unsigned int frame_width, unsigned int frame_height, unsigned int frame_pitch, unsigned int pixel_format) {};
|
|
void SetShowDebug(const bool show){ this->showDebug = show; };
|
|
void SetDebugLog(debug_log_t func){debugLogFunc = func;};
|
|
|
|
private:
|
|
bool showDebug;
|
|
debug_log_t debugLogFunc;
|
|
};
|
|
|
|
#endif
|
|
|
|
typedef void * (*create_game_ai_t)(const char *);
|
|
typedef void (*destroy_game_ai_t)(void * obj_ptr);
|
|
typedef void (*game_ai_lib_init_t)(void * obj_ptr, void * ram_ptr, int ram_size);
|
|
typedef void (*game_ai_lib_think_t)(void * obj_ptr, bool buttons[GAMEAI_MAX_BUTTONS], int player, const void *frame_data, unsigned int frame_width, unsigned int frame_height, unsigned int frame_pitch, unsigned int pixel_format);
|
|
typedef void (*game_ai_lib_set_show_debug_t)(void * obj_ptr, const bool show);
|
|
typedef void (*game_ai_lib_set_debug_log_t)(void * obj_ptr, debug_log_t func);
|