| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/program.cpp $ |
| 21 | * $Revision: 8 $ |
| 22 | * $Date: 5/13/99 3:41p $ |
| 23 | * $Author: Ardussi $ |
| 24 | * |
| 25 | * program state info |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/program.cpp $ |
| 28 | * |
| 29 | * 8 5/13/99 3:41p Ardussi |
| 30 | * changes for compiling on the Mac |
| 31 | * |
| 32 | * 7 4/15/99 1:42a Jeff |
| 33 | * changes for linux compile |
| 34 | * |
| 35 | * 6 4/14/99 3:57a Jeff |
| 36 | * fixed case mismatch in #includes |
| 37 | * |
| 38 | * 5 10/18/98 9:12p Matt |
| 39 | * Use new symbolic constant for the program name. |
| 40 | * |
| 41 | * 4 10/12/98 1:45p Samir |
| 42 | * added version key to database. |
| 43 | * |
| 44 | * 3 10/08/98 7:30p Samir |
| 45 | * changed version numbers. |
| 46 | * |
| 47 | * 2 10/02/98 12:30p Samir |
| 48 | * added version information for beta/demo. |
| 49 | * |
| 50 | * 3 2/04/97 5:07p Samir |
| 51 | * Added windowed state to determine if we run in a window |
| 52 | * |
| 53 | * 2 2/04/97 2:30p Samir |
| 54 | * Changed program_state to program_version. |
| 55 | * |
| 56 | * 1 2/03/97 4:42p Samir |
| 57 | * Program version control |
| 58 | * |
| 59 | * $NoKeywords: $ |
| 60 | */ |
| 61 | |
| 62 | #include "program.h"cxx . . $ `<file>/Descent3/program.h`/ |
| 63 | #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/ |
| 64 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ |
| 65 | |
| 66 | #include "appdatabase.h"cxx . . $ `<file>/lib/appdatabase.h`/ |
| 67 | |
| 68 | program_versioncxx . . $ program_version# Program_versioncxx . . $ Program_version.; |
| 69 | |
| 70 | // Initializes the current program state |
| 71 | |
| 72 | void ProgramVersioncxx . . $ ProgramVersion(b7da6bfc483bec3f).(int version_type, uint8_tcxx . . $ uint8_t# major, uint8_tcxx . . $ uint8_t# minor, uint8_tcxx . . $ uint8_t# build) { |
| 73 | oeLnxAppDatabasecxx . . $ oeLnxAppDatabase# dbasecxx . . $ oeLnxAppDatabase#oeLnxAppDatabase(7e3a78ff70dc88ae).((oeLnxAppDatabasecxx . . $ oeLnxAppDatabase# *)Databasecxx . . $ Database.); |
| 74 | |
| 75 | Program_versioncxx . . $ Program_version..version_typecxx . . $ program_version#version_type. = version_type; |
| 76 | Program_versioncxx . . $ Program_version..majorcxx . . $ program_version#major. = major; |
| 77 | Program_versioncxx . . $ Program_version..minorcxx . . $ program_version#minor. = minor; |
| 78 | Program_versioncxx . . $ Program_version..buildcxx . . $ program_version#build. = build; |
| 79 | |
| 80 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(beta) = 0; |
| 81 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(demo) = 0; |
| 82 | |
| 83 | if (version_type & BETA_VERSIONcxx . . $ `Descent3/program.h:165:9`!) |
| 84 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(beta) = 1; |
| 85 | if (version_type & DEMO_VERSIONcxx . . $ `Descent3/program.h:166:9`!) |
| 86 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(demo) = 1; |
| 87 | |
| 88 | switch (version_type & (~0xf000)) { |
| 89 | case DEVELOPMENT_VERSIONcxx . . $ `Descent3/program.h:162:9`!: |
| 90 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(debug) = 1; |
| 91 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(editor) = 0; |
| 92 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(release) = 0; |
| 93 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(windowed) = 0; |
| 94 | break; |
| 95 | |
| 96 | case RELEASE_VERSIONcxx . . $ `Descent3/program.h:163:9`!: |
| 97 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(debug) = 0; |
| 98 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(editor) = 0; |
| 99 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(release) = 0; |
| 100 | PROGRAMcxx . . $ `Descent3/program.h:183:9`!(windowed) = 0; |
| 101 | break; |
| 102 | |
| 103 | default: |
| 104 | Int3cxx . . $ `misc/pserror.h:247:9`!(); // NO NO NO |
| 105 | } |
| 106 | |
| 107 | if (dbase.lookup_recordcxx . . $ oeLnxAppDatabase#lookup_record(c5f7da30cbc0f4e9).("Version")) { |
| 108 | dbase.writecxx . . $ oeLnxAppDatabase#write(2551bed5d6fc04f6).("Major", Program_versioncxx . . $ Program_version..majorcxx . . $ program_version#major.); |
| 109 | dbase.writecxx . . $ oeLnxAppDatabase#write(2551bed5d6fc04f6).("Minor", Program_versioncxx . . $ Program_version..minorcxx . . $ program_version#minor.); |
| 110 | dbase.writecxx . . $ oeLnxAppDatabase#write(2551bed5d6fc04f6).("Build", Program_versioncxx . . $ Program_version..buildcxx . . $ program_version#build.); |
| 111 | } else { |
| 112 | Errorcxx . . $ Error(326aeb464d16410c).("Unable to find version key for %s", PRODUCT_NAMEcxx . . $ `Descent3/descent.h:140:9`!); |
| 113 | } |
| 114 | } |