Skip to content

Commit

Permalink
Merge pull request #165 from walkero-gr/refactoring-pr
Browse files Browse the repository at this point in the history
Refactoring menus, localization, events and library opening
  • Loading branch information
walkero-gr authored Dec 4, 2021
2 parents fdd0d28 + 3b1d964 commit 3fca8d2
Show file tree
Hide file tree
Showing 24 changed files with 1,019 additions and 690 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ indent_style = tab
indent_style = tab

[*.{c,h,cpp,hpp}]
indent_size = 2
indent_size = 4

[*.{yml,yaml}]
indent_style = space
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
iGame
src/*_cat.*
src/*.o
src/iGame_strings.h
iGame.0*0
iGame_rel/iGame.info
iGame.MOS
Expand Down
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
## iGame 2.1b3 - [future]
## iGame 2.1b3 - [2021-12-04]
### Added
- Added a check if the screenshot image is supported by the installed datatypes. If not, it is skipped. This fixes situations where the Info datatype is not installed and no image is shown instead of the default.

### Fixed
- Fixed the menus on Aros 68k. Menus should work on ApolloOS now.

### Changed
- Gathered the strings methods into one separate file. This is work that needs to be done so to make funcs.c smaller. Also merged the strcasestr.c and strdup.c files.
- The games list is not multiselect now. This speeds up a little bit the selection of games on slow machines.
- Moved the strings methods to a separate file. Also merged the strcasestr.c and strdup.c files.
- Moved the filesystem methods to a separate file.
- Set local methods as static in the funcs.c and cleaned up the iGameExtern.h from the shared methods
- Now all the libraries open on application start and close on application exit. No OpenLibrary() calls in the middle of the application.
- Moved the joystick methods from iGameMain.c to funcs.c
- A lot of global methods and variables removed
- A lot of refactoring happened, so to make funcs.c file smaller. This makes code more clear and readable.
- All the necessary libraries and interfaces are set to be loaded in the code. No "-lauto" is necessary any more.
- Changed the localization system to support the new menus. Now the strings header file is created based on catcomp

## iGame 2.1b2 - [2021-03-15]
### Added
Expand Down
13 changes: 5 additions & 8 deletions Makefile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ CFLAGS_OS4 = -c +aosppc -dontwarn=-1 -O2 -D__USE_INLINE__ -DCPU_VERS=AmigaOS4 $(
# Builder settings
##########################################################################
#MKLIB = join
LIBFLAGS = +aos68k -lamiga -lauto -o
LIBFLAGS_MOS = +morphos -lamiga -lauto -o
LIBFLAGS_OS4 = +aosppc -lamiga -lauto -o
LIBFLAGS = +aos68k -lamiga -o
LIBFLAGS_MOS = +morphos -lamiga -o
LIBFLAGS_OS4 = +aosppc -lamiga -o

##########################################################################
# Object files which are part of iGame
Expand All @@ -84,11 +84,8 @@ include make_includes/rules.inc
##########################################################################
# catalog files
##########################################################################
src/iGame_cat.c: catalogs/iGame.cd catalogs/C_c.sd
cd catalogs && flexcat iGame.cd ../src/iGame_cat.c=C_c.sd

src/iGame_cat.h: catalogs/iGame.cd catalogs/C_h.sd
cd catalogs && flexcat iGame.cd ../src/iGame_cat.h=C_h.sd
src/iGame_strings.h: catalogs/iGame.cd catalogs/CatComp_h.sd
cd catalogs && flexcat iGame.cd ../src/iGame_strings.h=CatComp_h.sd

catalogs/%/iGame.catalog: catalogs/%/iGame.ct catalogs/iGame.cd
flexcat catalogs/iGame.cd $< CATALOG $@ FILL QUIET || exit 0
Expand Down
216 changes: 216 additions & 0 deletions catalogs/CatComp_h.sd
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
##rem $Id$
##stringtype C
##shortstrings
/*
%b_strings.h
Header strings file for iGame

Copyright (c) 2018, Emmanuel Vasilakis

This file is part of iGame.

iGame 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 Foundation, either version 3 of the License, or
(at your option) any later version.

iGame 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 iGame. If not, see <http://www.gnu.org/licenses/>.
*/

/****************************************************************

This file was created automatically by `%fv'
from "%f0"

using the custom CatComp_h.sd

Do NOT edit by hand!

****************************************************************/

#ifndef %b_STRINGS_H
#define %b_STRINGS_H

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif

#ifdef %b_CODE
#ifndef %b_BLOCK
#define %b_ARRAY
#endif
#endif

#ifdef %b_ARRAY
#ifndef %b_NUMBERS
#define %b_NUMBERS
#endif
#ifndef %b_STRINGS
#define %b_STRINGS
#endif
#endif

#ifdef %b_BLOCK
#ifndef %b_STRINGS
#define %b_STRINGS
#endif
#endif


/****************************************************************************/


#ifdef %b_NUMBERS

#define %i %d

#endif /* %b_NUMBERS */


/****************************************************************************/


#ifdef %b_STRINGS

#define %i_STR %s

#endif /* %b_STRINGS */


/****************************************************************************/


#ifdef %b_ARRAY

struct %b_ArrayType
{
LONG cca_ID;
CONST_STRPTR cca_Str;
};

static const struct %b_ArrayType %b_Array[] =
{
{ %i, (CONST_STRPTR)%i_STR },
};


#endif /* %b_ARRAY */


/****************************************************************************/


#ifdef %b_BLOCK

STATIC CONST UBYTE %b_Block[] =
{

"%4a" "%2t"\n %i_STR "%z"

};

#endif /* %b_BLOCK */


/****************************************************************************/


#ifndef PROTO_LOCALE_H
#ifndef __NOLIBBASE__
#define _NLB_DEFINED_
#define __NOLIBBASE__
#endif
#ifndef __NOGLOBALIFACE__
#define _NGI_DEFINED_
#define __NOGLOBALIFACE__
#endif
#include <proto/locale.h>
#ifdef _NLB_DEFINED_
#undef __NOLIBBASE__
#undef _NLB_DEFINED_
#endif
#ifdef _NGI_DEFINED_
#undef __NOGLOBALIFACE__
#undef _NGI_DEFINED_
#endif
#endif

struct %b_LocaleInfo
{
#ifndef __amigaos4__
struct Library *li_LocaleBase;
#else
struct LocaleIFace *li_ILocale;
#endif
struct Catalog *li_Catalog;
};


#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

CONST_STRPTR %b_GetString(struct %b_LocaleInfo *li, LONG stringNum);

#ifdef __cplusplus
}
#endif /* __cplusplus */


#ifdef %b_CODE


CONST_STRPTR %b_GetString(struct %b_LocaleInfo *li, LONG stringNum)
{
#ifndef __amigaos4__
struct Library *LocaleBase = li->li_LocaleBase;
#else
struct LocaleIFace *ILocale = li->li_ILocale;
#endif
LONG *l;
UWORD *w;
CONST_STRPTR builtIn = NULL;

l = (LONG *)CatCompBlock;

while (*l != stringNum && l < (LONG *)(&CatCompBlock[sizeof(CatCompBlock)]))
{
w = (UWORD *)((ULONG)l + 4);
l = (LONG *)((ULONG)l + (ULONG)*w + 6);
}
if (*l == stringNum)
{
builtIn = (CONST_STRPTR)((ULONG)l + 6);
}

#ifndef __amigaos4__
if (LocaleBase)
{
return GetCatalogStr(li->li_Catalog, stringNum, builtIn);
}
#else
if (ILocale)
{
#ifdef __USE_INLINE__
return GetCatalogStr(li->li_Catalog, stringNum, builtIn);
#else
return ILocale->GetCatalogStr(li->li_Catalog, stringNum, builtIn);
#endif
}
#endif
return builtIn;
}

#endif /* %b_CODE */


/****************************************************************************/


#endif /* %b_STRINGS_H */
10 changes: 6 additions & 4 deletions catalogs/iGame.cd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MSG_AppDescription (//)
A front-end to WHDLoad
;MUIB
MSG_AppCopyright (//)
Emmanuel Vasilakis, Dimitris Panokostas
Emmanuel Vasilakis
;MUIB window Title
MSG_WI_MainWindow (//)
iGame
Expand All @@ -32,7 +32,7 @@ MSG_MNMainAddnonWHDLoadgameChar (//)
A_
;MUIB Menu Title
MSG_MNMainMenuShowHidehiddenentries (//)
Show/Hide hidden entries
Show hidden entries
;MUIB Menu Title
MSG_MNMainOpenList (//)
Open List...
Expand Down Expand Up @@ -86,7 +86,7 @@ MSG_MNMainiGameSettings (//)
Settings...
;MUIB Menu Title
MSG_MNlabel2GameRepositories (//)
Game Repositories...
Repositories...
;MUIB Menu Title
MSG_MNMainMUISettings (//)
MUI Settings...
Expand Down Expand Up @@ -308,7 +308,7 @@ MSG_LA_StartWithFavorites (//)
Display favorites on start
;MUIB Menu Title
MSG_MNMainOpenCurrentDir (//)
Open Game Dir
Open game folder
;MUIB Menu ShortCut
MSG_MNMainOpenCurrentDirChar (//)
W_
Expand All @@ -318,3 +318,5 @@ Slave path does not exist!
;compiled for
MSG_compiledForAboutWin (//)
compiled for
MSG_MNMainPreferences (//)
Preferences
7 changes: 2 additions & 5 deletions make_includes/obj_000.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# object files (generic 000)
##########################################################################

src/funcs.o: src/funcs.c src/iGame_cat.h src/strfuncs.h src/fsfuncs.h
src/funcs.o: src/funcs.c src/iGame_strings.h src/strfuncs.h src/fsfuncs.h
$(CC) $(CFLAGS) $(INCLUDES) -o $@ src/funcs.c

src/iGameGUI.o: src/iGameGUI.c src/iGameGUI.h src/iGame_cat.h src/fsfuncs.h
src/iGameGUI.o: src/iGameGUI.c src/iGameGUI.h src/iGame_strings.h src/fsfuncs.h
$(CC) $(CFLAGS) $(INCLUDES) -o $@ src/iGameGUI.c

src/iGameMain.o: src/iGameMain.c
Expand All @@ -16,6 +16,3 @@ src/strfuncs.o: src/strfuncs.c src/strfuncs.h

src/fsfuncs.o: src/fsfuncs.c src/fsfuncs.h
$(CC) $(CFLAGS) $(INCLUDES) -o $@ src/fsfuncs.c

src/iGame_cat.o: src/iGame_cat.c
$(CC) $(CFLAGS) $(INCLUDES) -o $@ src/iGame_cat.c
7 changes: 2 additions & 5 deletions make_includes/obj_030.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# object files (030)
##########################################################################

src/funcs_030.o: src/funcs.c src/iGame_cat.h src/strfuncs.h src/fsfuncs.h
src/funcs_030.o: src/funcs.c src/iGame_strings.h src/strfuncs.h src/fsfuncs.h
$(CC) $(CFLAGS_030) $(INCLUDES) -o $@ src/funcs.c

src/iGameGUI_030.o: src/iGameGUI.c src/iGameGUI.h src/iGame_cat.h src/fsfuncs.h
src/iGameGUI_030.o: src/iGameGUI.c src/iGameGUI.h src/iGame_strings.h src/fsfuncs.h
$(CC) $(CFLAGS_030) $(INCLUDES) -o $@ src/iGameGUI.c

src/iGameMain_030.o: src/iGameMain.c
Expand All @@ -16,6 +16,3 @@ src/strfuncs_030.o: src/strfuncs.c src/strfuncs.h

src/fsfuncs_030.o: src/fsfuncs.c src/fsfuncs.h src/funcs.h src/iGameExtern.h
$(CC) $(CFLAGS_030) $(INCLUDES) -o $@ src/fsfuncs.c

src/iGame_cat_030.o: src/iGame_cat.c
$(CC) $(CFLAGS_030) $(INCLUDES) -o $@ src/iGame_cat.c
7 changes: 2 additions & 5 deletions make_includes/obj_040.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# object files (040)
##########################################################################

src/funcs_040.o: src/funcs.c src/iGame_cat.h src/strfuncs.h src/fsfuncs.h
src/funcs_040.o: src/funcs.c src/iGame_strings.h src/strfuncs.h src/fsfuncs.h
$(CC) $(CFLAGS_040) $(INCLUDES) -o $@ src/funcs.c

src/iGameGUI_040.o: src/iGameGUI.c src/iGameGUI.h src/iGame_cat.h src/fsfuncs.h
src/iGameGUI_040.o: src/iGameGUI.c src/iGameGUI.h src/iGame_strings.h src/fsfuncs.h
$(CC) $(CFLAGS_040) $(INCLUDES) -o $@ src/iGameGUI.c

src/iGameMain_040.o: src/iGameMain.c
Expand All @@ -16,6 +16,3 @@ src/strfuncs_040.o: src/strfuncs.c src/strfuncs.h

src/fsfuncs_040.o: src/fsfuncs.c src/fsfuncs.h
$(CC) $(CFLAGS_040) $(INCLUDES) -o $@ src/fsfuncs.c

src/iGame_cat_040.o: src/iGame_cat.c
$(CC) $(CFLAGS_040) $(INCLUDES) -o $@ src/iGame_cat.c
Loading

0 comments on commit 3fca8d2

Please sign in to comment.