- BORLAND/: Borland C++ 4.52 (chosen over 4.5 by byte-match: CODE/RP/CW32.LIB
is identical to 4.52's install lib). BCC32/TLINK32/TLIB/MAKE run natively on
Win11; CODE/BT/OPT.MAK is the shipped BTL4OPT.EXE's exact flag recipe
(extender = Borland PowerPack DPMI32, not Phar Lap TNT).
- restoration/source410/: the literal 1995-form reconstruction of the missing
BT game source (never mixed into CODE/). Round 1-3 state:
* 6 of 10 surviving original TUs COMPILE CLEAN under the period toolchain
(BTMSSN, BTCNSL, BTSCNRL, BTTEAM, BTL4MODE, BTL4ARND) - first builds
since 1996.
* BT_L4/BTL4APP.CPP pilot reconstruction: 12/12 functions, Fail() lands on
its binary-recorded line 400 exactly.
* BT/BTCNSL.HPP: console wire IDs recovered from the binary's ctors
(Killed=9, Damaged=10, ScoreUpdate=13, DeathWithoutHonor=15 [T1];
TeamScore=12 flagged [T4]).
* MUNGA/: 8 engine-header backfills back-dated from the BT412 WinTesla tree
(VDATA numbering decomp-verified; AUDREND's OpenAL-era virtual removed -
the period compiler is the drift detector).
* Tooling: backdate.py (WinTesla->1995 header transform), compile410.sh
(per-TU verification sweep under authentic OPT.MAK flags).
* README: corrected roadmap - MECH.HPP is the capstone grown with the mech
TU reconstructions; BTREG.CPP green = the header-family milestone.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
196 lines
6.6 KiB
C++
196 lines
6.6 KiB
C++
// BDE - (C) Copyright 1995 by Borland International
|
|
|
|
// config.c
|
|
#include "snipit.h"
|
|
|
|
static void DisplayCfgFile(pCHAR CfgPath, INT16 Level) ;
|
|
|
|
//=====================================================================
|
|
// Function:
|
|
// Configuration();
|
|
//
|
|
// Description:
|
|
// This example dumps the information contained in the
|
|
// IDAPI configuration file, as well as displaying which
|
|
// configuration file is being used.
|
|
//=====================================================================
|
|
void
|
|
Configuration (void)
|
|
{
|
|
SYSConfig sysConfig; // Used for storing the system configuration
|
|
// information - used to determine the
|
|
// location of the configuration file
|
|
DBIResult rslt; // Return value from IDAPI functions
|
|
|
|
Screen("*** Configuration Example ***\r\n");
|
|
|
|
BREAK_IN_DEBUGGER();
|
|
|
|
Screen(" Initializing IDAPI...");
|
|
rslt = DbiInit(NULL);
|
|
if (ChkRslt(rslt, "Init") != DBIERR_NONE)
|
|
{
|
|
Screen("\r\n*** End of Example ***");
|
|
return;
|
|
}
|
|
|
|
// Turn on trace information if the debug layer is anabled (DLLSWAP.EXE).
|
|
DbiDebugLayerOptions(DEBUGON | OUTPUTTOFILE, "SNIPIT.INF");
|
|
|
|
// Specify where temporary files are placed.
|
|
rslt = DbiSetPrivateDir(szPrivDirectory);
|
|
ChkRslt(rslt, "SetPrivateDir");
|
|
|
|
// Determine which configuration file is being used.
|
|
rslt = DbiGetSysConfig(&sysConfig);
|
|
ChkRslt(rslt, "GetSysConfig");
|
|
|
|
Screen("\r\n Display the information in the currently used"
|
|
" configuration file:\r\n\r\n\t\t %s\r\n", sysConfig.szIniFile);
|
|
|
|
// Call the recursive function which dumps information from the
|
|
// configuration file.
|
|
DisplayCfgFile ("\\", 0) ;
|
|
|
|
// Turn off trace information.
|
|
DbiDebugLayerOptions(0, NULL);
|
|
|
|
// Close IDAPI.
|
|
Screen("\r\n Exiting IDAPI...");
|
|
rslt = DbiExit();
|
|
ChkRslt(rslt, "Exit");
|
|
|
|
Screen("\r\n*** End of Example ***");
|
|
}
|
|
|
|
//=====================================================================
|
|
// Function:
|
|
// DisplayCfgFile(CfgPath, Level);
|
|
//
|
|
// Input: CfgPath - Path within the CFG file to the desired
|
|
// option within the configuration file. Starts
|
|
// at "\\" for the root of the configuration tree
|
|
// Level - Depth of Recursion
|
|
//
|
|
// Return: None
|
|
//
|
|
// Desc: This recursive function is used to display all information
|
|
// within the configuration file.
|
|
//=====================================================================
|
|
void
|
|
DisplayCfgFile (pCHAR CfgPath, INT16 Level)
|
|
{
|
|
DBIResult rslt; // Value to return
|
|
hDBICur hCur; // Handle to the cursor
|
|
pCHAR szNode; // String which contains the name of the node
|
|
pCFGDesc CfgDesc; // Configuration descriptor
|
|
INT16 iLoop; // Loop variable - used for indenting
|
|
INT16 BaseSize; // Length of the current node
|
|
|
|
// Open the Configuration file - returns the configuration options
|
|
// for the current level in a schema table referenced by hCur.
|
|
rslt = DbiOpenCfgInfoList(NULL, dbiREADONLY, cfgPersistent, CfgPath,
|
|
&hCur);
|
|
if (ChkRslt(rslt, "OpenCfgInfoList") == DBIERR_NONE)
|
|
{
|
|
// Allocate resources - make block large enough to contain all
|
|
// information.
|
|
szNode = (pCHAR)malloc(512 * sizeof(CHAR));
|
|
if (! szNode)
|
|
{
|
|
Screen(" Error - Out of memory");
|
|
return;
|
|
}
|
|
|
|
CfgDesc = (pCFGDesc)malloc(sizeof(CFGDesc));
|
|
if (! CfgDesc)
|
|
{
|
|
Screen(" Error - Out of memory");
|
|
return;
|
|
}
|
|
|
|
// Initialize descriptor to 0.
|
|
memset((void *)CfgDesc, 0, sizeof(CFGDesc));
|
|
|
|
// Process all nodes/paths.
|
|
// Get the next record in the table - contains the next option
|
|
// of the given level in the tree.
|
|
while (DbiGetNextRecord(hCur, dbiNOLOCK, (pBYTE) CfgDesc, NULL)
|
|
== DBIERR_NONE)
|
|
{
|
|
// Clear the szNode variable.
|
|
szNode[0] = 0;
|
|
|
|
// Indent according to the depth of the configuration option.
|
|
for (iLoop = 0; iLoop < Level; iLoop++)
|
|
{
|
|
strcat(szNode, " ");
|
|
}
|
|
|
|
// Output this node, copying the name of the node to the
|
|
// szNode variable.
|
|
strcat(szNode, CfgDesc->szNodeName);
|
|
Screen(szNode);
|
|
|
|
// Process this node if it has sub-nodes.
|
|
if (CfgDesc->bHasSubnodes)
|
|
{
|
|
// Determine if this is a base node.
|
|
if (Level == 0)
|
|
{
|
|
sprintf(szNode, "%s%s", CfgPath, CfgDesc->szNodeName);
|
|
}
|
|
else // If not a base node.
|
|
{
|
|
sprintf(szNode, "%s\\%s", CfgPath,
|
|
CfgDesc->szNodeName);
|
|
}
|
|
|
|
// Recursively call this function to get information about
|
|
// sub-nodes.
|
|
DisplayCfgFile(szNode, (Level + 1));
|
|
}
|
|
else // No sub-nodes...
|
|
{
|
|
// Clear the szNode variable.
|
|
szNode[0] = 0;
|
|
|
|
// Indent according to the depth of the config option.
|
|
for (iLoop = 0; iLoop <= Level; iLoop++)
|
|
{
|
|
strcat(szNode, " ");
|
|
}
|
|
|
|
// Determine the length of the string.
|
|
BaseSize = strlen(szNode);
|
|
|
|
// Display the remaining information & description.
|
|
sprintf(&szNode[BaseSize], "Desc: %s",
|
|
CfgDesc->szDescription);
|
|
Screen(szNode);
|
|
|
|
// Display the type of the node.
|
|
sprintf(&szNode[BaseSize], "Type: %d",
|
|
CfgDesc->iDataType);
|
|
Screen(szNode);
|
|
|
|
// Display the value of the node.
|
|
sprintf(&szNode[BaseSize], " Val: %s", CfgDesc->szValue);
|
|
Screen(szNode);
|
|
}
|
|
|
|
// Initialize descriptor to 0.
|
|
memset((void *) CfgDesc, 0, sizeof(CFGDesc));
|
|
}
|
|
|
|
// Clean up.
|
|
free(szNode);
|
|
free((pCHAR) CfgDesc);
|
|
if (hCur)
|
|
{
|
|
rslt = DbiCloseCursor(&hCur);
|
|
ChkRslt(rslt, "CloseCursor");
|
|
}
|
|
}
|
|
}
|