PokeMe64/include/scenes/InitTransferPakScene.h
Philippe Symons c0638e8d69 Various changes
- Upgrade libpokemegb to commit c47f8b3

- [Korean gen II games]: Make the UI show Trainer and Pokémon instead of the actual trainer name and pokémon name.
  This is needed because our font does not include the necessary characters for the Korean games. And while I could attempt to add them, I don't sufficiently care to do so.

- Attempt to randomize random values. This is needed for random IVs and shininess chances.
  It's not entirely clear to me whether the rand() function would actually return random values in previous versions of PokeMe64.
  While libdragon does gather entropy at bootup and implements a getentropy() function, I don't see this function referenced anywhere.
  That being said, it DOES look like libstdc++ would call a getentropy() function, so perhaps this is a way in which getentropy() from libdragon would get called.
  But I'm not using libstdc++'s functionality to obtain random values, I'm using libc's rand() function. And I don't see any reference from libc (for rand()) to getentropy(), so...
  At the very least we might need to use values from getentropy() to seed with srand(). But because I have trust issues with randomizing pseudo-random values in a system
  that doesn't have a system clock, I also added trainerID, trainerName and the number of elapsed cpu cycles until we are going to the main menu to the seed. I might consider
  adding the RTC values for gen II games to the seed as well later.
2025-02-10 12:35:11 +01:00

45 lines
1.3 KiB
C++
Executable File

#ifndef _INITTRANSFERPAKSCENE_H
#define _INITTRANSFERPAKSCENE_H
#include "scenes/SceneWithDialogWidget.h"
#include "widget/TransferPakDetectionWidget.h"
class TransferPakManager;
/**
* @brief In this scene implementation, we do the detection of the N64 transfer pak and whether a supported Pokémon game was
* detected.
*/
class InitTransferPakScene : public SceneWithDialogWidget
{
public:
InitTransferPakScene(SceneDependencies& deps, void* context);
virtual ~InitTransferPakScene();
void init() override;
void destroy() override;
void render(RDPQGraphics& gfx, const Rectangle& sceneBounds) override;
void onDialogDone();
void onTransferPakWidgetStateChanged(TransferPakWidgetState newState);
protected:
private:
void setupTPakDetectWidget();
void setupDialog(DialogWidgetStyle& style) override;
void loadGameType();
void loadSaveMetadata();
const char* getGameTypeString();
sprite_t* menu9SliceSprite_;
TransferPakDetectionWidget tpakDetectWidget_;
WidgetFocusChainSegment tpakDetectWidgetSegment_;
DialogData diagData_;
TextRenderSettings pokeMe64TextSettings_;
const char* gameTypeString_;
// build up a random seed for srand(). I'm doing this in an attempt to truly randomize IVs and shininess.
unsigned int randomSeed_;
};
#endif