Skip to content
Permalink
Browse files

Improved version string handling

  • Loading branch information
midwan committed Dec 1, 2019
1 parent 6081503 commit 693c44e514c49e4631f83383600525cb3c17a8c7
Showing with 41 additions and 31 deletions.
  1. +27 −27 src/main.cpp
  2. +8 −0 src/osdep/amiberry.cpp
  3. +1 −1 src/osdep/gui/PanelAbout.cpp
  4. +5 −3 src/osdep/target.h
@@ -517,32 +517,32 @@ static TCHAR* parsetextpath(const TCHAR* s)

void usage()
{
printf("\nAmiberry - Amiga emulator v3.0.4 (2019-11-26)\n");
printf("\nUsage:\n");
printf(" -h Show this help.\n");
printf(" --help Show this help.\n");
printf(" -f <file> Load a configuration file.\n");
printf(" -config=<file> Load a configuration file.\n");
printf(" -autoload=<file> Load a WHDLoad game or .CUE CD32 image.\n");
printf(" -statefile=<file> Load a save state file.\n");
printf(" -s <config param>=<value> Set the configuration parameter with value.\n");
printf(" Edit a configuration file in order to know valid parameters and settings.\n");
printf("\nAdditional options:\n");
printf(" -0 <filename> Set adf for drive 0.\n");
printf(" -1 <filename> Set adf for drive 1.\n");
printf(" -2 <filename> Set adf for drive 2.\n");
printf(" -3 <filename> Set adf for drive 3.\n");
printf(" -r <filename> Set kickstart rom file.\n");
printf(" -G Start directly into emulation.\n");
printf(" -c <value> Size of chip memory (in number of 512 KBytes chunks).\n");
printf(" -F <value> Size of fast memory (in number of 1024 KBytes chunks).\n");
printf("\nNote:\n");
printf("Parameters are parsed from the beginning of command line, so in case of ambiguity for parameters, last one will be used.\n");
printf("File names should be with absolute path.\n");
printf("\nExample:\n");
printf("amiberry -config=conf/A500.uae -statefile=savestates/game.uss -s use_gui=no\n");
printf("It will load A500.uae configuration with the save state named game.\n");
printf("It will override use_gui to 'no' so that it enters emulation directly.\n");
std::cout << get_version_string() << std::endl;
std::cout << "Usage:" << std::endl;
std::cout << " -h Show this help." << std::endl;
std::cout << " --help Show this help." << std::endl;
std::cout << " -f <file> Load a configuration file." << std::endl;
std::cout << " -config=<file> Load a configuration file." << std::endl;
std::cout << " -autoload=<file> Load a WHDLoad game or .CUE CD32 image." << std::endl;
std::cout << " -statefile=<file> Load a save state file." << std::endl;
std::cout << " -s <config param>=<value> Set the configuration parameter with value." << std::endl;
std::cout << " Edit a configuration file in order to know valid parameters and settings." << std::endl;
std::cout << "\nAdditional options:" << std::endl;
std::cout << " -0 <filename> Set adf for drive 0." << std::endl;
std::cout << " -1 <filename> Set adf for drive 1." << std::endl;
std::cout << " -2 <filename> Set adf for drive 2." << std::endl;
std::cout << " -3 <filename> Set adf for drive 3." << std::endl;
std::cout << " -r <filename> Set kickstart rom file." << std::endl;
std::cout << " -G Start directly into emulation." << std::endl;
std::cout << " -c <value> Size of chip memory (in number of 512 KBytes chunks)." << std::endl;
std::cout << " -F <value> Size of fast memory (in number of 1024 KBytes chunks)." << std::endl;
std::cout << "\nNote:" << std::endl;
std::cout << "Parameters are parsed from the beginning of command line, so in case of ambiguity for parameters, last one will be used." << std::endl;
std::cout << "File names should be with absolute path." << std::endl;
std::cout << "\nExample:" << std::endl;
std::cout << "amiberry -config=conf/A500.uae -statefile=savestates/game.uss -s use_gui=no" << std::endl;
std::cout << "It will load A500.uae configuration with the save state named game." << std::endl;
std::cout << "It will override use_gui to 'no' so that it enters emulation directly." << std::endl;
exit(1);
}

@@ -798,7 +798,7 @@ void check_error_sdl(const bool check, const char* message)
{
if (check)
{
cout << message << " " << SDL_GetError() << endl;
std::cout << message << " " << SDL_GetError() << std::endl;
SDL_Quit();
exit(-1);
}
@@ -64,6 +64,14 @@ int action_replay_button = SDLK_PAUSE;
// No default value for Full Screen toggle
int fullscreen_key = 0;

std::string get_version_string()
{
std::string label_text = TARGET_NAME;
label_text += " ";
label_text += AMIBERRYVERSION;
return label_text;
}

void set_key_configs(struct uae_prefs* p)
{
if (strncmp(p->open_gui, "", 1) != 0)
@@ -17,7 +17,7 @@ void InitPanelAbout(const struct _ConfigCategory& category)
{
amiberryLogoImage = gcn::Image::load("data/amiberry-logo.png");
icon = new gcn::Icon(amiberryLogoImage);
lblEmulatorVersion = new gcn::Label("Amiberry v3.0.4 (2019-11-26)");
lblEmulatorVersion = new gcn::Label(get_version_string());

textBox = new gcn::TextBox(
"Dimitris Panokostas (MiDWaN) - Amiberry author\n"
@@ -7,7 +7,7 @@
#pragma once
#include <SDL.h>

#define TARGET_NAME "amiberry"
#define TARGET_NAME _T("Amiberry")

#define NO_MAIN_IN_MAIN_C

@@ -19,11 +19,13 @@

#define MAKEBD(x,y,z) ((((x) - 2000) * 10000 + (y)) * 100 + (z))
#define GETBDY(x) ((x) / 1000000 + 2000)
#define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
#define GETBDM(x) (((x) - (((x) / 10000) * 10000)) / 100)
#define GETBDD(x) ((x) % 100)

#define AMIBERRYVERSION _T("v3.0.4 (2019-12-01)")
#define AMIBERRYDATE MAKEBD(2019, 12, 01)

#define AMIBERRYDATE MAKEBD(2019, 5, 17)
extern std::string get_version_string();

STATIC_INLINE FILE *uae_tfopen(const TCHAR *path, const TCHAR *mode)
{

10 comments on commit 693c44e

@joolswills

This comment has been minimized.

Copy link
Contributor

joolswills replied Dec 2, 2019

I was testing performance with Ofast Vs O2 with the demo Arte and I noticed it didn't boot with the latest Amiberry. I bisected to this commit.

Seems as though it fails to load the configured kickstart after this change and falls back to the AROS one which it doesn't work with - the "k" is missing from my configured kick13 in the gui - some odd buffer issue?

I can't obviously see anything in this commit which would cause this and haven't had time to debug further.

Can open a proper issue in next day or two if needed.

@midwan

This comment has been minimized.

Copy link
Owner Author

midwan replied Dec 4, 2019

@joolswills
It's not related to this commit, I've seen this happen a few times before that.
However, it would only happen if I switched between older and newer versions of Amiberry, not under "normal" circumstances.

I think it's related to this commit instead: 657676f

@midwan

This comment has been minimized.

Copy link
Owner Author

midwan replied Dec 4, 2019

@joolswills
And this should be fixed with 6207900 now ;-)
Let me know if you see it around again!

@joolswills

This comment has been minimized.

Copy link
Contributor

joolswills replied Dec 5, 2019

Thanks.

@joolswills

This comment has been minimized.

Copy link
Contributor

joolswills replied Dec 5, 2019

Unfortunately the problem is still present with v3.0.6.

If I revert this commit and do a clean build it works again. I will open an issue with configs etc tomorrow but this commit does seem relevant. Thanks.

@joolswills

This comment has been minimized.

Copy link
Contributor

joolswills replied Dec 5, 2019

When I say relevant, it could be that this commit just reveals a buffer overflow bug elsewhere. Unfortunately I've had had time to debug it fully yet.

@joolswills

This comment has been minimized.

Copy link
Contributor

joolswills replied Dec 5, 2019

If you turn on warnings there's lots of warnings regarding cfgfile.cpp and possible buffer overflows (and issues with other files). I suspect fixing up stuff like that (and using const when needed) will work towards resolving the issue.

@joolswills

This comment has been minimized.

Copy link
Contributor

joolswills replied Dec 5, 2019

Turns out the issue was actually just in this commit. TARGET_NAME changed from amiberry to Amiberry. This name is used for the cfg file setting prefix for ROM path etc it seems. This seems odd/wrong anyway. But changing it back fixes it for old configs.

As most people will be using older versions it's probably best to switch this back imho (or another workaround).

@midwan

This comment has been minimized.

Copy link
Owner Author

midwan replied Dec 5, 2019

@joolswills
Aarrgh, I missed that. Thanks for locating it, I'll get it fixed today :)

@midwan

This comment has been minimized.

Copy link
Owner Author

midwan replied Dec 5, 2019

Hopefully fixed with 814c062 now :)

Please sign in to comment.
You can’t perform that action at this time.