Added a Virtual Jaguar Rx logo in the About window
[clinton/Virtual-Jaguar-Rx.git] / src / file.cpp
index 73d255e..9201c1e 100644 (file)
@@ -7,6 +7,7 @@
 //\r
 // JLH = James Hammons <jlhamm@acm.org>\r
 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>\r
+//  RG = Richard Goedeken\r
 //\r
 // Who  When        What\r
 // ---  ----------  ------------------------------------------------------------\r
@@ -17,6 +18,8 @@
 // JPM  07/15/2016  DWARF format support\r
 // JPM  04/06/2019  Added ELF sections check\r
 // JPM  03/12/2020  Added ELF section types check and new error messages\r
+// JPM   Aug./2020  ELF executable file information\r
+//  RG   Jan./2021  Linux build fixes\r
 //\r
 \r
 #include "file.h"\r
@@ -25,6 +28,8 @@
 #endif // _MSC_VER\r
 #include <stdarg.h>\r
 #include <string.h>\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
 #include "crc32.h"\r
 #include "filedb.h"\r
 #include "eeprom.h"\r
@@ -34,8 +39,8 @@
 #include "universalhdr.h"\r
 #include "unzip.h"\r
 #include "zlib.h"\r
-#include "libelf/libelf.h"\r
-#include "libelf/gelf.h"\r
+#include "libelf.h"\r
+#include "gelf.h"\r
 #include "libdwarf.h"\r
 #include "debugger/ELFManager.h"\r
 #include "debugger/DBGManager.h"\r
@@ -147,6 +152,7 @@ bool JaguarLoadFile(char * path)
        int     DBGType = DBG_NO_TYPE;\r
        bool error;\r
        int err;\r
+       struct stat _statbuf;\r
 \r
        jaguarROMSize = JaguarLoadROM(buffer, path);\r
 \r
@@ -200,9 +206,13 @@ WriteLog("FILE: Cartridge run address is reported as $%X...\n", jaguarRunAddress
 \r
                if (PtrELFExe != NULL)\r
                {\r
+                       // check the ELF version\r
                        if ((elf_version(EV_CURRENT) != EV_NONE) && (ElfMem = ELFManager_MemOpen(PtrELFExe, jaguarROMSize)))\r
                        {\r
-                               if (ELFManager_DwarfInit(ElfMem))\r
+                               // get the file information\r
+                               stat(path, &_statbuf);\r
+\r
+                               if (ELFManager_DwarfInit(ElfMem, _statbuf))\r
                                {\r
                                        DBGType |= DBG_ELFDWARF;\r
                                }\r