Terminate execution if an essential library fails to open
This commit is contained in:
parent
30cdaa1aa9
commit
4329c7a328
|
@ -5251,7 +5251,9 @@ int main(int argc, char** argv)
|
|||
nslog_init(NULL, &argc, argv);
|
||||
|
||||
/* Need to do this before opening any splash windows etc... */
|
||||
ami_libs_open();
|
||||
if ((ami_libs_open() == false)) {
|
||||
return 20; /* FAIL */
|
||||
}
|
||||
|
||||
/* Open splash window */
|
||||
Object *splash_window = ami_gui_splash_open();
|
||||
|
|
106
amiga/libs.c
106
amiga/libs.c
|
@ -22,12 +22,13 @@
|
|||
|
||||
#include <proto/exec.h>
|
||||
|
||||
#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER) \
|
||||
#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
|
||||
LOG(("Opening %s v%d", LIB, LIBVER)); \
|
||||
if((PREFIX##Base = OpenLibrary(LIB, LIBVER))) { \
|
||||
I##PREFIX = (struct PREFIX##IFace *)GetInterface(PREFIX##Base, INTERFACE, INTVER, NULL); \
|
||||
} else { \
|
||||
warn_user("CompError", LIB); \
|
||||
if(FAIL == true) return false; \
|
||||
}
|
||||
|
||||
#define AMINS_LIB_CLOSE(PREFIX) \
|
||||
|
@ -78,69 +79,55 @@ AMINS_LIB_STRUCT(String);
|
|||
AMINS_LIB_STRUCT(Window);
|
||||
|
||||
|
||||
void ami_libs_open(void)
|
||||
bool ami_libs_open(void)
|
||||
{
|
||||
AMINS_LIB_OPEN("application.library", 53, Application, "application", 2)
|
||||
AMINS_LIB_OPEN("asl.library", 37, Asl, "main", 1)
|
||||
AMINS_LIB_OPEN("datatypes.library", 37, DataTypes, "main", 1)
|
||||
AMINS_LIB_OPEN("diskfont.library", 50, Diskfont, "main", 1)
|
||||
AMINS_LIB_OPEN("gadtools.library", 37, GadTools, "main", 1)
|
||||
AMINS_LIB_OPEN("graphics.library", 50, Graphics, "main", 1)
|
||||
AMINS_LIB_OPEN("icon.library", 50, Icon, "main", 1)
|
||||
AMINS_LIB_OPEN("iffparse.library", 37, IFFParse, "main", 1)
|
||||
AMINS_LIB_OPEN("intuition.library", 37, Intuition, "main", 1)
|
||||
AMINS_LIB_OPEN("keymap.library", 37, Keymap, "main", 1)
|
||||
AMINS_LIB_OPEN("layers.library", 37, Layers, "main", 1)
|
||||
AMINS_LIB_OPEN("locale.library", 37, Locale, "main", 1)
|
||||
AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1)
|
||||
AMINS_LIB_OPEN("workbench.library", 37, Workbench, "main", 1)
|
||||
AMINS_LIB_OPEN("application.library", 53, Application, "application", 2, false)
|
||||
AMINS_LIB_OPEN("asl.library", 37, Asl, "main", 1, true)
|
||||
AMINS_LIB_OPEN("datatypes.library", 37, DataTypes, "main", 1, true)
|
||||
AMINS_LIB_OPEN("diskfont.library", 50, Diskfont, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadtools.library", 37, GadTools, "main", 1, true)
|
||||
AMINS_LIB_OPEN("graphics.library", 50, Graphics, "main", 1, true)
|
||||
AMINS_LIB_OPEN("icon.library", 50, Icon, "main", 1, true)
|
||||
AMINS_LIB_OPEN("iffparse.library", 37, IFFParse, "main", 1, true)
|
||||
AMINS_LIB_OPEN("intuition.library", 37, Intuition, "main", 1, true)
|
||||
AMINS_LIB_OPEN("keymap.library", 37, Keymap, "main", 1, true)
|
||||
AMINS_LIB_OPEN("layers.library", 37, Layers, "main", 1, true)
|
||||
AMINS_LIB_OPEN("locale.library", 37, Locale, "main", 1, true)
|
||||
AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, true)
|
||||
AMINS_LIB_OPEN("workbench.library", 37, Workbench, "main", 1, true)
|
||||
|
||||
/* BOOPSI classes.
|
||||
* \todo These should be opened using OpenClass(), however as
|
||||
* the macros all use the deprecated _GetClass() functions,
|
||||
* we may as well just open them normally for now. */
|
||||
|
||||
AMINS_LIB_OPEN("classes/arexx.class", 50, ARexx, "main", 1)
|
||||
AMINS_LIB_OPEN("images/bevel.image", 50, Bevel, "main", 1)
|
||||
AMINS_LIB_OPEN("images/bitmap.image", 50, BitMap, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/checkbox.gadget", 50, CheckBox, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/chooser.gadget", 50, Chooser, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/clicktab.gadget", 50, ClickTab, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/fuelgauge.gadget", 50, FuelGauge, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/getfile.gadget", 50, GetFile, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/getfont.gadget", 50, GetFont, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/getscreenmode.gadget", 50, GetScreenMode, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/integer.gadget", 50, Integer, "main", 1)
|
||||
AMINS_LIB_OPEN("images/label.image", 50, Label, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/layout.gadget", 50, Layout, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/listbrowser.gadget", 50, ListBrowser, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/radiobutton.gadget", 50, RadioButton, "main", 1)
|
||||
AMINS_LIB_OPEN("classes/requester.class", 50, Requester, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/scroller.gadget", 50, Scroller, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/space.gadget", 50, Space, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/speedbar.gadget", 50, SpeedBar, "main", 1)
|
||||
AMINS_LIB_OPEN("gadgets/string.gadget", 50, String, "main", 1)
|
||||
AMINS_LIB_OPEN("classes/window.class", 50, Window, "main", 1)
|
||||
AMINS_LIB_OPEN("classes/arexx.class", 50, ARexx, "main", 1, true)
|
||||
AMINS_LIB_OPEN("images/bevel.image", 50, Bevel, "main", 1, true)
|
||||
AMINS_LIB_OPEN("images/bitmap.image", 50, BitMap, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/checkbox.gadget", 50, CheckBox, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/chooser.gadget", 50, Chooser, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/clicktab.gadget", 50, ClickTab, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/fuelgauge.gadget", 50, FuelGauge, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/getfile.gadget", 50, GetFile, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/getfont.gadget", 50, GetFont, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/getscreenmode.gadget", 50, GetScreenMode, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/integer.gadget", 50, Integer, "main", 1, true)
|
||||
AMINS_LIB_OPEN("images/label.image", 50, Label, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/layout.gadget", 50, Layout, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/listbrowser.gadget", 50, ListBrowser, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/radiobutton.gadget", 50, RadioButton, "main", 1, true)
|
||||
AMINS_LIB_OPEN("classes/requester.class", 50, Requester, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/scroller.gadget", 50, Scroller, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/space.gadget", 50, Space, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/speedbar.gadget", 50, SpeedBar, "main", 1, true)
|
||||
AMINS_LIB_OPEN("gadgets/string.gadget", 50, String, "main", 1, true)
|
||||
AMINS_LIB_OPEN("classes/window.class", 50, Window, "main", 1, true)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ami_libs_close(void)
|
||||
{
|
||||
AMINS_LIB_CLOSE(Application)
|
||||
AMINS_LIB_CLOSE(Asl)
|
||||
AMINS_LIB_CLOSE(DataTypes)
|
||||
AMINS_LIB_CLOSE(Diskfont)
|
||||
AMINS_LIB_CLOSE(GadTools)
|
||||
AMINS_LIB_CLOSE(Graphics)
|
||||
AMINS_LIB_CLOSE(Icon)
|
||||
AMINS_LIB_CLOSE(IFFParse)
|
||||
AMINS_LIB_CLOSE(Intuition)
|
||||
AMINS_LIB_CLOSE(Keymap)
|
||||
AMINS_LIB_CLOSE(Layers)
|
||||
AMINS_LIB_CLOSE(Locale)
|
||||
AMINS_LIB_CLOSE(P96)
|
||||
AMINS_LIB_CLOSE(Workbench)
|
||||
|
||||
AMINS_LIB_CLOSE(ARexx)
|
||||
AMINS_LIB_CLOSE(Bevel)
|
||||
AMINS_LIB_CLOSE(BitMap)
|
||||
|
@ -162,5 +149,20 @@ void ami_libs_close(void)
|
|||
AMINS_LIB_CLOSE(SpeedBar)
|
||||
AMINS_LIB_CLOSE(String)
|
||||
AMINS_LIB_CLOSE(Window)
|
||||
|
||||
AMINS_LIB_CLOSE(Application)
|
||||
AMINS_LIB_CLOSE(Asl)
|
||||
AMINS_LIB_CLOSE(DataTypes)
|
||||
AMINS_LIB_CLOSE(Diskfont)
|
||||
AMINS_LIB_CLOSE(GadTools)
|
||||
AMINS_LIB_CLOSE(Graphics)
|
||||
AMINS_LIB_CLOSE(Icon)
|
||||
AMINS_LIB_CLOSE(IFFParse)
|
||||
AMINS_LIB_CLOSE(Intuition)
|
||||
AMINS_LIB_CLOSE(Keymap)
|
||||
AMINS_LIB_CLOSE(Layers)
|
||||
AMINS_LIB_CLOSE(Locale)
|
||||
AMINS_LIB_CLOSE(P96)
|
||||
AMINS_LIB_CLOSE(Workbench)
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
*/
|
||||
|
||||
#ifndef AMIGA_LIBS_H
|
||||
void ami_libs_open(void);
|
||||
#include <stdbool.h>
|
||||
|
||||
bool ami_libs_open(void);
|
||||
void ami_libs_close(void);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue