$mt) $mt = $sd_mt; if($dg_mt > $mt) $mt = $dg_mt; return($mt); } function GameDBEntriesSortCompare($a, $b) { if($a['name'] == $b['name']) return strcmp($a['id'], $b['id']); return strcmp($a['name'], $b['name']); } function ReadModules() { global $mod_list, $mednafen_version; $fp = fopen("modules.def", "rb"); $mednafen_version = trim(fgets($fp)); while(!feof($fp)) { $mod = array(); $mod['name'] = trim(fgets($fp)); if($mod['name'] == "") break; $mod['fullname'] = trim(fgets($fp)); $mod['nominal_width'] = (int)fgets($fp); $mod['nominal_height'] = (int)fgets($fp); $mod['cpinfo'] = array(); $cpicount = (int)trim(fgets($fp)); while($cpicount--) { $gfn = trim(fgets($fp)); $mod['cpinfo'][$gfn] = array(); $mod['cpinfo'][$gfn]['gfn'] = $gfn; $mod['cpinfo'][$gfn]['description'] = trim(fgets($fp)); $mod['cpinfo'][$gfn]['valid_entry_count'] = explode(' ', trim(fgets($fp))); } asort($mod['cpinfo']); // // // $mod['dbinfo'] = array(); $dbicount = (int)trim(fgets($fp)); for($dbi = 0; $dbi < $dbicount; $dbi++) { $mod['dbinfo'][$dbi] = array(); $mod['dbinfo'][$dbi]['shortname'] = stripcslashes(trim(fgets($fp))); $mod['dbinfo'][$dbi]['fullname'] = stripcslashes(trim(fgets($fp))); $mod['dbinfo'][$dbi]['description'] = stripcslashes(trim(fgets($fp))); $mod['dbinfo'][$dbi]['entries'] = array(); $eicount = (int)trim(fgets($fp)); for($ei = 0; $ei < $eicount; $ei++) { $mod['dbinfo'][$dbi]['entries'][$ei] = array(); $mod['dbinfo'][$dbi]['entries'][$ei]['name'] = stripcslashes(trim(fgets($fp)));; $mod['dbinfo'][$dbi]['entries'][$ei]['id'] = stripcslashes(trim(fgets($fp))); $mod['dbinfo'][$dbi]['entries'][$ei]['idishash'] = (int)trim(fgets($fp)); $mod['dbinfo'][$dbi]['entries'][$ei]['setting'] = stripcslashes(trim(fgets($fp))); $mod['dbinfo'][$dbi]['entries'][$ei]['purpose'] = stripcslashes(trim(fgets($fp))); } usort($mod['dbinfo'][$dbi]['entries'], "GameDBEntriesSortCompare"); } // // // $mod_list[$mod['name']] = $mod; } fclose($fp); } function ReadSettings() { global $settings_g; $settings_g = array(); $fp = fopen("settings.def", "rb"); while(!feof($fp)) { $setting = array(); $setting['name'] = trim(fgets($fp)); $setting['flags'] = trim(fgets($fp)); $setting['description'] = stripcslashes(trim(fgets($fp))); $setting['description_extra'] = stripcslashes(trim(fgets($fp))); $setting['type'] = trim(fgets($fp)); $setting['default_value'] = trim(fgets($fp)); $setting['minimum'] = trim(fgets($fp)); $setting['maximum'] = trim(fgets($fp)); $enum_count = (int)fgets($fp); $enum_list = array(); while($enum_count--) { $ele = array(); $ele['string'] = trim(fgets($fp)); $ele['description'] = stripcslashes(trim(fgets($fp))); $ele['description_extra'] = stripcslashes(trim(fgets($fp))); array_push($enum_list, $ele); } $setting['enum_list'] = $enum_list; if($setting['name'] != "") $settings_g[$setting['name']] = $setting; //array_push($settings_g, $setting); } fclose($fp); } function BeginPage($module_name, $module_description) { global $mednafen_version, $curmod, $cursection, $ps_string, $toc_string, $section_depth; ReadSettings(); ReadModules(); $curmod = $module_name; $section_depth++; $ps_string = ' Mednafen ' . htmlspecialchars($module_description) . ' Documentation

Mednafen

' . htmlspecialchars($module_description) . ' Documentation

Last updated ' . strftime("%B %e, %Y", GetMTime()) . '
Valid as of ' . htmlspecialchars($mednafen_version) . '
'; $toc_string = '

Table of Contents:
'; $end_string = ''; $end_string .= ' '; $section_depth--; $section_string = ob_get_contents(); ob_end_clean(); if($section_depth != 0) { fprintf(STDERR, "Mismatched BeginSection()/EndSection(): %d\n", $section_depth); exit(1); } echo($ps_string); echo($toc_string); echo($section_string); echo($end_string); $section_depth--; } function ExternalSection($name, $link, $nonlink_text = "") { global $mednafen_version, $curmod, $cursection, $ps_string, $toc_string, $section_depth, $sections, $section_endhtml; $toc_string .= '
  • ' . htmlspecialchars($name) . '' . htmlspecialchars($nonlink_text); } function BeginSection($name, $aname, $header_link = FALSE) { global $mednafen_version, $curmod, $cursection, $ps_string, $toc_string, $section_depth, $sections, $section_endhtml; global $section_aname_usage; if(isset($section_aname_usage[$aname])) { fprintf(STDERR, "Section aname \"" . $aname . "\" already used!"); exit(1); } $section_aname_usage[$aname] = true; array_push($sections, $name); $section_depth++; if($aname === FALSE) $toc_string .= '
  • ' . htmlspecialchars($name) . '