use crate::guest_call::{MenuBarBuildResume, MenuBarCallOrigin};
#[cfg(test)]
use super::pef::SECTION_KIND_UNPACKED_DATA;
use super::pef::{
apply_pef_relocations_detailed, instantiate_pef_sections, parse_pef_header,
parse_pef_imported_symbols, parse_pef_loader_header, parse_pef_reloc_headers,
parse_pef_sections, pef_reloc_chunk_stream, resolve_pef_imports, PefRelocApplyError,
PefRelocContext, SECTION_KIND_CODE, SECTION_KIND_CONSTANT,
};
use super::ApplicationSizeResource;
use crate::callback_manager::CallbackTaskArchitecture;
use crate::cfm::fragment::{
first_base_for_kind, first_data_base, resolve_fragment_exports, section_bases, CfmFragmentPlan,
CfmSection as MappedSection,
};
use crate::cfm::{CfmLoadId, CfmOperation, CfmResourceCall, CfmResourcePreparation};
use crate::event_queue::{
EventQueue, EventQueueProbeSnapshot, EventRecordSnapshot, QueuedEvent,
};
use crate::guest_call::{
format_ppc_import_action, install_powerpc_call_arguments, ExecutionMenuViews,
GuestCallContinuation, GuestCallEffect, GuestCallRequest, GuestCallTarget, MenuTrackingCall,
MenuTrackingOrigin, NativeRetirement, SharedGuestCallStack,
};
use crate::guest_procedure::{
resolve_guest_procedure, GuestIsa, GuestProcedure,
ROUTINE_DESCRIPTOR_HEADER_SIZE as PPC_ROUTINE_DESCRIPTOR_HEADER_SIZE,
ROUTINE_DESCRIPTOR_MIXED_MODE_TRAP as PPC_MIXED_MODE_TRAP,
ROUTINE_DESCRIPTOR_VERSION as PPC_ROUTINE_DESCRIPTOR_VERSION,
ROUTINE_FLAG_DONT_PASS_SELECTOR as PPC_ROUTINE_FLAG_DONT_PASS_SELECTOR,
ROUTINE_FLAG_USE_NATIVE_ISA as PPC_ROUTINE_FLAG_USE_NATIVE_ISA,
ROUTINE_RECORD_FLAGS_OFFSET as PPC_ROUTINE_RECORD_FLAGS_OFFSET,
ROUTINE_RECORD_ISA_OFFSET as PPC_ROUTINE_RECORD_ISA_OFFSET,
ROUTINE_RECORD_M68K_ISA as PPC_ROUTINE_RECORD_M68K_ISA,
ROUTINE_RECORD_POWERPC_ISA as PPC_ROUTINE_RECORD_POWERPC_ISA,
ROUTINE_RECORD_PROC_DESCRIPTOR_OFFSET as PPC_ROUTINE_RECORD_PROC_DESCRIPTOR_OFFSET,
ROUTINE_RECORD_SIZE as PPC_ROUTINE_RECORD_SIZE,
};
#[cfg(test)]
use crate::guest_procedure::{
ROUTINE_FLAG_PROC_DESCRIPTOR_RELATIVE as PPC_ROUTINE_FLAG_PROC_DESCRIPTOR_RELATIVE,
ROUTINE_RECORD_SELECTOR_OFFSET as PPC_ROUTINE_RECORD_SELECTOR_OFFSET,
};
use crate::list_manager::ProcessListManagerState;
use crate::machine_profile::{
POWERPC_CARBON_VERSION_BCD, POWERPC_SYSTEM_VERSION_BCD, REFERENCE_MACHINE_PROFILE,
REFERENCE_POWERPC_EXECUTION_CAPABILITIES,
};
use crate::managers::resource::{
serialize_resource_fork_with_attrs, ResourceFork, ResourceForkEntry,
};
pub(crate) use crate::memory::{GuestAddressSpace as PpcSectionMem, MacMemoryBus, MemoryBus};
use crate::menu_manager::{
MenuDefinitionTracking, MenuTrackingKind, SharedNativeMenuSelection,
};
use crate::menu_model::GuestMenuSnapshot;
use crate::process_context::{
ProcessAeDescriptor, ProcessAppleEventHandler, ProcessContext, ProcessFileSystemState,
ProcessSyntheticAppleEvent,
ProcessHandleHeap, ProcessHandleRecord, ProcessHandleStateRecord,
ProcessMemoryManager, ProcessNewHandleBackend, ProcessNewHandleRequest,
ProcessNativeHeapState, ProcessNativeMemoryManager, ProcessPtrRecord,
ProcessResourceManagerState, ProcessVfsFileRecords,
ProcessVfsResourceFileRecords, ProcessWorkingDirectory, SharedProcessAppleEventDescriptors,
SharedProcessAppleEventHandlers, SharedProcessAppleEventLaunchState,
SharedProcessCallbackScheduling, SharedProcessCollectionManager, SharedProcessCursorState,
SharedProcessDialogText, SharedProcessDisplayClut,
SharedProcessControlManager, SharedProcessEventQueue,
SharedProcessFileSystem, SharedProcessGraphicsDevice, SharedProcessGraphicsPort,
SharedProcessInputState, SharedProcessMemoryManager,
DEFAULT_QUICKDRAW_HILITE_COLOR,
SharedProcessMixedModeM68kState,
SharedProcessQuickDrawError, SharedProcessQuickDrawHiliteColors, SharedProcessQuickDrawOpColors,
SharedProcessDisplayGamma, SharedProcessQuickDrawPixelStates, SharedProcessResourcePolicy,
SharedProcessTickState, SharedProcessTimerTasks, SharedProcessVblTasks,
SharedProcessWindowList,
};
use crate::process_manager::{
resolve_process_application_metadata, ProcessSerialNumber, SingleProcessEnumeration,
};
use crate::quickdraw::fonts::style::{
get_italic_end_extend, get_italic_slant, get_italic_underline_extend_left,
};
use crate::quickdraw::fonts::{
font_id_for_name, font_name_for_id, get_font_face, get_font_face_scale_ratio,
get_font_face_scaled, FONT_APPLICATION,
};
use crate::quickdraw::text::{
get_font_metrics, get_glyph, get_glyph_italic, get_underline_thickness, QuickDrawTextStyle,
};
use crate::trap::extended80::Extended80;
use crate::trap::manager::{
TrapManager, TrapManagerMemoryOp, TrapManagerMemoryResult, TrapManagerSetError, TrapTableKind,
};
use crate::trap::types::{decode_mac_roman, encode_mac_roman_lossy, Rect};
use crate::trap::{pict, TrapDispatcher};
use crate::thread_manager::{RetiredThreadStorageEdge, ThreadManager};
use crate::ui_theme::{render_scrollbar_bitmap, Rgb8, ThemeBitmap, UiThemeId};
use ppc::{
PpcAlignmentPolicy, PpcCpu, PpcException, PpcExecutionContext, PpcFetchHistogram,
PpcFetchObserver, PpcImportAction, PpcMemory, PpcMemoryWriteObserver, PpcNativeReturnGpr3,
PpcRunResult,
};
use std::cell::Cell;
use std::collections::{HashMap, HashSet, VecDeque};
use std::sync::OnceLock;
mod dispatch_cfm;
use dispatch_cfm::*;
mod dispatch_apple_events;
use dispatch_apple_events::*;
mod dispatch_appletalk;
mod dispatch_appearance;
mod dispatch_bit_transfers;
mod dispatch_color_tables;
mod dispatch_collection;
mod dispatch_core_foundation;
mod dispatch_control;
mod dispatch_cursor;
mod dispatch_desk;
mod dispatch_devices;
mod dispatch_dialog;
mod dispatch_drawsprocket;
mod dispatch_event;
mod dispatch_files;
mod dispatch_fonts;
mod dispatch_gestalt;
mod dispatch_graphics_devices;
mod dispatch_gworlds;
mod dispatch_icon_services;
mod dispatch_inputsprocket;
mod dispatch_list;
mod dispatch_low_memory;
mod dispatch_math;
mod dispatch_memory;
mod dispatch_menu;
mod dispatch_mixed_mode;
mod dispatch_native_exceptions;
use dispatch_native_exceptions::*;
mod dispatch_palettes;
mod dispatch_picture;
mod dispatch_polygons;
mod dispatch_printing;
mod dispatch_process;
mod dispatch_qd3d;
mod dispatch_quickdraw;
mod dispatch_quicktime;
mod dispatch_regions;
mod dispatch_resources;
mod dispatch_scrap;
mod dispatch_sound;
mod dispatch_standard_file;
mod dispatch_textedit;
mod dispatch_threads;
mod dispatch_time;
mod dispatch_stdc;
mod dispatch_stdio;
mod dispatch_system;
mod dispatch_toolbox;
mod dispatch_window;
mod dispatch_display;
use dispatch_control::*;
pub(crate) use dispatch_dialog::PpcDialogCallbackState;
pub(crate) use dispatch_collection::PpcCollectionCallbackState;
use dispatch_dialog::*;
pub(crate) use dispatch_stdc::{PpcQsortState, PpcStdSignalState};
pub(in crate::systems::macintosh::loader::ppc) use dispatch_mixed_mode::*;
pub(super) use dispatch_stdc::*;
pub(crate) use dispatch_stdio::*;
pub use dispatch_stdio::PpcStdIoOperation;
pub use dispatch_system::PpcSystemCompatibilityOperation;
#[cfg(test)]
pub(super) use dispatch_system::ppc_munger_compatibility;
pub(super) use dispatch_window::*;
#[cfg(test)]
use dispatch_display::*;
#[cfg(test)]
use dispatch_list::*;
use dispatch_standard_file::*;
mod pef_dump;
mod theme;
#[cfg(test)]
use pef_dump::format_pef_dump_json;
use pef_dump::{maybe_write, PefDumpContext};
use theme::*;
use dispatch_time::ppc_sync_vbl_task_links;
#[cfg(test)]
pub(crate) use dispatch_time::{
ppc_install_time_task, ppc_install_vbl_task, ppc_remove_time_task, ppc_remove_vbl_task,
};
use dispatch_event::{
dispatch_button_import, dispatch_getkeys_import, dispatch_microseconds_import,
dispatch_still_down_import, dispatch_tick_count_import, ppc_still_down_result,
ppc_wait_mouse_up_result, PpcTickCountIdlePollState,
};
pub mod graphics;
pub mod menu;
pub mod files;
pub mod textedit;
pub mod regions;
pub mod quickdraw;
pub mod fixmath;
pub mod gworlds;
pub mod memory;
pub mod resources;
pub mod events;
pub mod palettes;
pub mod imports;
pub mod qd3d;
pub(crate) mod qd3d_text;
mod loaded_app_qd3d;
mod loaded_app_callbacks;
mod loaded_app_vfs;
mod loaded_app_memory;
mod loaded_app_process;
mod loaded_app_input;
mod loaded_app_time;
mod loaded_app_display;
mod loaded_app_menu;
mod loaded_app_resources;
mod loaded_app_probes;
mod loaded_app_mixed_mode;
mod loaded_app_gateways;
pub mod quicktime;
pub mod sound;
pub mod sprockets;
pub mod vfs;
pub use graphics::*;
pub use menu::*;
pub(crate) use files::*;
pub(crate) use textedit::*;
use regions::*;
pub(crate) use quickdraw::*;
pub(crate) use fixmath::*;
pub(crate) use gworlds::*;
pub(crate) use memory::*;
pub(crate) use resources::*;
pub(crate) use events::*;
pub(crate) use palettes::*;
pub use imports::*;
pub use qd3d::*;
pub use quicktime::*;
pub use sound::*;
pub use sprockets::*;
pub use vfs::*;
#[derive(Debug, Clone, Copy)]
struct SystemlessPpcImportBindingPolicy;
impl PpcImportBindingPolicy for SystemlessPpcImportBindingPolicy {
fn dispatcher_target(&self, library: &str, symbol: &str) -> PpcImportDispatcherTarget {
dispatcher_target_for_import(library, symbol)
}
fn fixed_data_address(&self, library: &str, symbol: &str) -> Option<u32> {
import_data_address_for(library, symbol)
}
fn is_explicit_hle_library(&self, library: &str) -> bool {
ppc_is_explicit_hle_cfm_library(library)
}
}
struct PpcConnectedCfmBindingPolicy<'a> {
connections: &'a [PpcCfmConnection],
}
impl PpcImportBindingPolicy for PpcConnectedCfmBindingPolicy<'_> {
fn dispatcher_target(&self, library: &str, symbol: &str) -> PpcImportDispatcherTarget {
dispatcher_target_for_import(library, symbol)
}
fn fixed_data_address(&self, library: &str, symbol: &str) -> Option<u32> {
import_data_address_for(library, symbol)
}
fn resolved_import_address(&self, library: &str, symbol: &str, _class: u8) -> Option<u32> {
self.connections
.iter()
.find(|connection| connection.library_name.eq_ignore_ascii_case(library))
.and_then(|connection| connection.exports.iter().find(|export| export.name == symbol))
.map(|export| export.address)
.or_else(|| self.fixed_data_address(library, symbol))
}
fn is_explicit_hle_library(&self, library: &str) -> bool {
ppc_is_explicit_hle_cfm_library(library)
}
}
fn ppc_import_layout() -> PpcImportLayout {
PpcImportLayout {
capacity: PPC_IMPORT_CAPACITY,
tvector_base: PPC_IMPORT_TVECTOR_BASE,
trap_base: PPC_IMPORT_TRAP_BASE,
}
}
fn ppc_initial_import_error(error: PpcImportBindingError) -> PpcLoadError {
match error {
PpcImportBindingError::SymbolIndexOutOfRange {
symbol_index,
import_count,
} => PpcLoadError::ImportBindingOutOfRange {
symbol_index,
import_count,
},
PpcImportBindingError::CapacityExceeded {
import_count,
capacity,
} => PpcLoadError::ImportCapacityExceeded {
import_count,
capacity,
},
PpcImportBindingError::CountOverflow
| PpcImportBindingError::BindingAddressOverflow
| PpcImportBindingError::AddressTableOutOfRange => PpcLoadError::AddressOverflow,
PpcImportBindingError::RegistryChanged => unreachable!("fresh import plan has no registry"),
}
}
pub(in crate::systems::macintosh::loader::ppc) fn ppc_dynamic_import_error(error: PpcImportBindingError) -> i16 {
match error {
PpcImportBindingError::CountOverflow
| PpcImportBindingError::CapacityExceeded { .. }
| PpcImportBindingError::AddressTableOutOfRange => PPC_FRAG_NO_MEM,
PpcImportBindingError::SymbolIndexOutOfRange { .. }
| PpcImportBindingError::BindingAddressOverflow
| PpcImportBindingError::RegistryChanged => PPC_FRAG_CORRUPT_ERR,
}
}
pub(crate) fn ppc_initial_process_file_system() -> SharedProcessFileSystem {
let mut state = ProcessFileSystemState::default();
state.stdio_streams = ppc_initial_stdio_streams();
state.next_file_ref_num = PPC_FIRST_FILE_REF_NUM;
state.vfs_directories.replace(initial_ppc_vfs_directories());
state
.next_vfs_dir_id
.with_mut(|next_dir_id| *next_dir_id = PPC_FIRST_DYNAMIC_DIR_ID);
state
.default_dir_id
.with_mut(|default_dir_id| *default_dir_id = PPC_ROOT_DIR_ID);
SharedProcessFileSystem::from_state(state)
}
pub const PPC_CODE_BASE: u32 = 0x0100_0000;
pub(crate) const PPC_CUR_RES_FILE_ADDR: u32 = 0x0000_0A5A;
pub const PPC_IMPORT_TVECTOR_BASE: u32 = 0x01e0_0000;
pub const PPC_IMPORT_TRAP_BASE: u32 = 0x01f0_0000;
const PPC_IMPORT_DATA_BASE: u32 = 0x01d0_0000;
const PPC_IMPORT_DATA_SIZE: usize = 0x1000;
const PPC_IMPORT_CTYPE_POINTER: u32 = PPC_IMPORT_DATA_BASE + 0x40c;
const PPC_IMPORT_MATH_PI: u32 = PPC_IMPORT_DATA_BASE + 0x410;
const PPC_IMPORT_MATH_FE_DFL_ENV: u32 = PPC_IMPORT_DATA_BASE + 0x418;
const PPC_IMPORT_STD_DBL_EPSILON: u32 = PPC_IMPORT_DATA_BASE + 0x420;
const PPC_IMPORT_STD_DBL_MAX: u32 = PPC_IMPORT_DATA_BASE + 0x428;
const PPC_IMPORT_STD_DBL_MIN: u32 = PPC_IMPORT_DATA_BASE + 0x430;
const PPC_IMPORT_STD_FLT_EPSILON: u32 = PPC_IMPORT_DATA_BASE + 0x438;
const PPC_IMPORT_STD_FLT_MAX: u32 = PPC_IMPORT_DATA_BASE + 0x43c;
const PPC_IMPORT_STD_FLT_MIN: u32 = PPC_IMPORT_DATA_BASE + 0x440;
const PPC_IMPORT_STD_ERRNO: u32 = PPC_IMPORT_DATA_BASE + 0x444;
const PPC_IMPORT_STD_MAC_OS_ERR: u32 = PPC_IMPORT_DATA_BASE + 0x448;
const PPC_IMPORT_CTYPE_TABLE: u32 = PPC_IMPORT_DATA_BASE + 0x500;
const PPC_IMPORT_CUR_AP_NAME: u32 = PPC_IMPORT_DATA_BASE + 0x900;
pub const PPC_CFM_MAIN_STUB_BASE: u32 = 0x01d8_0000;
pub const PPC_MAIN_GWORLD: u32 = 0x02f0_0000;
pub const PPC_MAIN_GDEVICE: u32 = 0x02f0_0100;
pub const PPC_DSP_BACK_GWORLD: u32 = 0x0501_0000;
pub const PPC_DATA_BASE: u32 = 0x0200_0000;
pub const PPC_HEAP_BASE: u32 = 0x0300_0000;
pub(crate) const PPC_HEAP_ALIGNMENT: u32 = 16;
pub const PPC_STACK_TOP: u32 = 0x0500_0000;
pub const PPC_DEFAULT_STACK_SIZE: u32 = 64 * 1024;
pub const PPC_STACK_SIZE: u32 = PPC_DEFAULT_STACK_SIZE;
pub const PPC_STACK_BASE: u32 = PPC_STACK_TOP - PPC_DEFAULT_STACK_SIZE;
pub const PPC_HALT_PC: u32 = 0;
const PPC_LOW_MEMORY_SIZE: usize = 64 * 1024;
const PPC_CLASSIC_APP_MEMORY_BASE: u32 = PPC_LOW_MEMORY_SIZE as u32;
pub(crate) const PPC_THE_ZONE_ADDR: u32 = 0x0000_0118;
const PPC_SYS_ZONE_ADDR: u32 = 0x0000_02a6;
const PPC_APPL_ZONE_ADDR: u32 = 0x0000_02aa;
const PPC_MMU_32BIT_ADDR: u32 = 0x0000_0cb2;
const PPC_CLASSIC_APP_MEMORY_SIZE: usize = 0x000f_0000;
pub const PPC_MEM_FULL_ERR: i16 = -108;
pub(crate) const PPC_NIL_HANDLE_ERR: i16 = -109;
pub(crate) const PPC_MEM_WZ_ERR: i16 = -111;
#[cfg(test)]
const PPC_MEM_PUR_ERR: i16 = -112;
const PPC_C_DEPTH_ERR: i16 = -157;
pub const PPC_NO_ERR: i16 = 0;
const PPC_EVT_NOT_ENB: i16 = 1;
pub const PPC_EOF_ERR: i16 = -39;
pub const PPC_FN_OPN_ERR: i16 = -38;
pub const PPC_POS_ERR: i16 = -40;
pub const PPC_NSV_ERR: i16 = -35;
pub const PPC_FNF_ERR: i16 = -43;
pub const PPC_DUP_FN_ERR: i16 = -48;
pub const PPC_RF_NUM_ERR: i16 = -51;
pub const PPC_WR_PERM_ERR: i16 = -61;
pub const PPC_PARAM_ERR: i16 = -50;
pub const PPC_C_RES_ERR: i16 = -156;
pub const PPC_DIR_NF_ERR: i16 = -120;
const PPC_PIXMAP_TOO_DEEP_ERR: i16 = -148;
const PPC_RGN_TOO_BIG_ERR: i16 = -500;
const PPC_OPEN_ERR: i16 = -23;
const PPC_BD_NAM_ERR: i16 = -37;
const PPC_PROC_NOT_FOUND_ERR: i16 = -600;
pub(super) const PPC_NOT_ENOUGH_HARDWARE_ERR: i16 = -201;
const PPC_SM_NO_MORE_SRSRCS_ERR: i16 = -344;
const PPC_NO_MPP_ERR: i16 = -3102;
const PPC_ERR_AE_DESC_NOT_FOUND: i16 = -1701;
const PPC_ERR_AE_COERCION_FAIL: i16 = -1700;
const PPC_ERR_AE_EVENT_NOT_HANDLED: i16 = -1708;
const PPC_AE_BUFFER_IS_SMALL: i16 = -607;
const PPC_HM_HELP_MANAGER_NOT_INITED: i16 = -855;
const PPC_HIGH_LEVEL_EVENT_MASK: u16 = 0x0400;
const PPC_HIGH_LEVEL_EVENT: u16 = 23;
const PPC_CORE_EVENT_CLASS: u32 = u32::from_be_bytes(*b"aevt");
const PPC_OPEN_APPLICATION_EVENT: u32 = u32::from_be_bytes(*b"oapp");
const PPC_TYPE_WILDCARD: u32 = u32::from_be_bytes(*b"****");
const PPC_KEY_EVENT_CLASS_ATTR: u32 = u32::from_be_bytes(*b"evcl");
const PPC_KEY_EVENT_ID_ATTR: u32 = u32::from_be_bytes(*b"evid");
const PPC_TYPE_TYPE: u32 = u32::from_be_bytes(*b"type");
pub const PPC_BAD_FORMAT: i16 = -206;
pub const PPC_CHANNEL_NOT_BUSY: i16 = -211;
pub const PPC_GESTALT_UNDEF_SELECTOR_ERR: i16 = -5551;
pub const PPC_GESTALT_DUP_SELECTOR_ERR: i16 = -5552;
pub const PPC_FRAG_LIB_NOT_FOUND: i16 = -2804;
pub const PPC_FRAG_FORMAT_UNKNOWN: i16 = -2806;
pub const PPC_FRAG_HAD_UNRESOLVEDS: i16 = -2807;
pub const PPC_FRAG_NO_MEM: i16 = -2809;
pub const PPC_FRAG_INIT_LOOP: i16 = -2815;
pub const PPC_FRAG_NO_ADDR_SPACE: i16 = -2810;
pub const PPC_FRAG_LIB_CONN_ERR: i16 = -2817;
pub const PPC_FRAG_CONNECTION_ID_NOT_FOUND: i16 = -2801;
pub const PPC_FRAG_SYMBOL_NOT_FOUND: i16 = -2802;
pub const PPC_FRAG_CORRUPT_ERR: i16 = -2820;
pub const PPC_FRAG_USER_INIT_PROC_ERR: i16 = -2821;
pub const PPC_FRAG_ARCH_ERR: i16 = -2823;
pub const PPC_INVALID_COMPONENT_ID: i16 = -3000;
pub const PPC_RES_NOT_FOUND_ERR: i16 = -192;
pub const PPC_RES_F_NOT_FOUND_ERR: i16 = -193;
pub const PPC_RESOURCE_IN_MEMORY_ERR: i16 = -188;
pub const PPC_INPUT_OUT_OF_BOUNDS_ERR: i16 = -190;
pub const PPC_ADD_RES_FAILED: i16 = -194;
pub const PPC_RMV_RES_FAILED: i16 = -196;
pub const PPC_RES_ATTR_ERR: i16 = -198;
pub const PPC_MAP_READ_ERR: i16 = -199;
pub(super) const BLR: u32 = 0x4e80_0020;
pub(super) const PPC_FIRST_FILE_REF_NUM: i16 = 128;
pub(crate) const PPC_CLOSED_RESOURCE_REF_NUM: i16 = i16::MIN;
const PPC_PICT_INFO_SIZE: u32 = 104;
const PPC_CFM_MAIN_STUB_COUNT: u32 = 256;
const PPC_IMPORT_CAPACITY: u32 = 4096;
const PPC_IMPORT_SLOT_COUNT: u32 = PPC_IMPORT_CAPACITY + 2;
const PPC_THREAD_RETURN_IMPORT_INDEX: u32 = PPC_IMPORT_CAPACITY + 1;
pub(super) const PPC_THREAD_RETURN_PC: u32 =
PPC_IMPORT_TRAP_BASE + PPC_THREAD_RETURN_IMPORT_INDEX * 4;
const PPC_GUEST_CALL_RETURN_IMPORT_INDEX: u32 = PPC_IMPORT_CAPACITY;
const PPC_FIRST_CFM_CONNECTION_ID: u32 = 1;
const PPC_CFM_FIND_LIB: u32 = 2;
const PPC_CFM_LOAD_LIB: u32 = 1;
const PPC_CFM_LOAD_NEW_COPY: u32 = 5;
const PPC_CFM_POWERPC_ARCH: u32 = u32::from_be_bytes(*b"pwpc");
const PPC_CFM_ANY_ARCH: u32 = 0x3F3F_3F3F;
#[cfg(test)]
use crate::cfm::CFM_INIT_BLOCK_SIZE as PPC_CFM_INIT_BLOCK_SIZE;
pub(super) const PPC_INITIAL_STACK_FRAME_SIZE: u32 = 64;
const PPC_INTERRUPT_RED_ZONE_SIZE: u32 = 224;
const PPC_PARAMETER_AREA_OFFSET: u32 = 24;
const PPC_LINKAGE_BACK_CHAIN_OFFSET: u32 = 0;
const PPC_LINKAGE_SAVED_CR_OFFSET: u32 = 4;
const PPC_LINKAGE_SAVED_LR_OFFSET: u32 = 8;
const PPC_LINKAGE_SAVED_RTOC_OFFSET: u32 = 20;
pub(super) const PPC_GUEST_CALL_RETURN_PC: u32 = PPC_IMPORT_TRAP_BASE + PPC_GUEST_CALL_RETURN_IMPORT_INDEX * 4;
const PPC_INITIALIZERS_TRAMPOLINE_BASE: u32 = PPC_IMPORT_TRAP_BASE - 0x1_0000;
const PPC_APPLICATION_INIT_RETURN_PC: u32 = PPC_IMPORT_TRAP_BASE - 0x100;
const PPC_EXCEPTION_INFORMATION_SIZE: u32 = 24;
const PPC_EXCEPTION_MACHINE_INFORMATION_SIZE: u32 = 64;
const PPC_EXCEPTION_REGISTER_INFORMATION_SIZE: u32 = 256;
const PPC_EXCEPTION_FPU_INFORMATION_SIZE: u32 = 264;
const PPC_EXCEPTION_VECTOR_INFORMATION_SIZE: u32 = 532;
const PPC_EXCEPTION_MEMORY_INFORMATION_SIZE: u32 = 16;
const PPC_ILLEGAL_INSTRUCTION_EXCEPTION: u32 = 1;
const PPC_TRAP_EXCEPTION: u32 = 2;
const PPC_UNMAPPED_MEMORY_EXCEPTION: u32 = 4;
const PPC_UNMAPPED_MEMORY_ERROR: u32 = 5;
const PPC_WRITE_REFERENCE: u32 = 0;
const PPC_READ_REFERENCE: u32 = 1;
const PPC_PROCINFO_CALLING_CONVENTION_MASK: u32 =
crate::mixed_mode::proc_info::CALLING_CONVENTION_MASK;
const PPC_PROCINFO_PASCAL_STACK_BASED: u32 = crate::mixed_mode::proc_info::PASCAL_STACK_BASED;
const PPC_PROCINFO_C_STACK_BASED: u32 = crate::mixed_mode::proc_info::C_STACK_BASED;
const PPC_PROCINFO_REGISTER_BASED: u32 = crate::mixed_mode::proc_info::REGISTER_BASED;
const PPC_PROCINFO_THINK_C_STACK_BASED: u32 = crate::mixed_mode::proc_info::THINK_C_STACK_BASED;
const PPC_PROCINFO_D0_DISPATCHED_PASCAL_STACK_BASED: u32 =
crate::mixed_mode::proc_info::D0_DISPATCHED_PASCAL_STACK_BASED;
const PPC_PROCINFO_D0_DISPATCHED_C_STACK_BASED: u32 =
crate::mixed_mode::proc_info::D0_DISPATCHED_C_STACK_BASED;
const PPC_PROCINFO_D1_DISPATCHED_PASCAL_STACK_BASED: u32 =
crate::mixed_mode::proc_info::D1_DISPATCHED_PASCAL_STACK_BASED;
const PPC_PROCINFO_STACK_DISPATCHED_PASCAL_STACK_BASED: u32 =
crate::mixed_mode::proc_info::STACK_DISPATCHED_PASCAL_STACK_BASED;
const PPC_PROCINFO_SPECIAL_CASE: u32 = crate::mixed_mode::proc_info::SPECIAL_CASE;
const PPC_PROCINFO_RESULT_SIZE_PHASE: u32 = crate::mixed_mode::proc_info::RESULT_SIZE_PHASE;
const PPC_PROCINFO_STACK_PARAMETER_PHASE: u32 = crate::mixed_mode::proc_info::STACK_PARAMETER_PHASE;
const PPC_PROCINFO_STACK_PARAMETER_WIDTH: u32 = crate::mixed_mode::proc_info::STACK_PARAMETER_WIDTH;
const PPC_PROCINFO_DISPATCHED_SELECTOR_SIZE_PHASE: u32 =
crate::mixed_mode::proc_info::DISPATCHED_SELECTOR_SIZE_PHASE;
const PPC_PROCINFO_DISPATCHED_PARAMETER_PHASE: u32 =
crate::mixed_mode::proc_info::DISPATCHED_PARAMETER_PHASE;
const PPC_PROCINFO_REGISTER_RESULT_LOCATION_PHASE: u32 =
crate::mixed_mode::proc_info::REGISTER_RESULT_LOCATION_PHASE;
const PPC_PROCINFO_REGISTER_PARAMETER_PHASE: u32 =
crate::mixed_mode::proc_info::REGISTER_PARAMETER_PHASE;
const PPC_PROCINFO_REGISTER_PARAMETER_WIDTH: u32 =
crate::mixed_mode::proc_info::REGISTER_PARAMETER_WIDTH;
const PPC_PROCINFO_REGISTER_PARAMETER_SIZE_MASK: u32 =
crate::mixed_mode::proc_info::REGISTER_PARAMETER_SIZE_MASK;
const PPC_PROCINFO_REGISTER_PARAMETER_WHICH_SHIFT: u32 =
crate::mixed_mode::proc_info::REGISTER_PARAMETER_WHICH_SHIFT;
const PPC_PROCINFO_REGISTER_PARAMETER_WHICH_MASK: u32 =
crate::mixed_mode::proc_info::REGISTER_PARAMETER_WHICH_MASK;
const PPC_PROCINFO_REGISTER_CCR_C: u32 = crate::mixed_mode::proc_info::REGISTER_CCR_C;
const PPC_PROCINFO_REGISTER_CCR_V: u32 = crate::mixed_mode::proc_info::REGISTER_CCR_V;
const PPC_PROCINFO_REGISTER_CCR_Z: u32 = crate::mixed_mode::proc_info::REGISTER_CCR_Z;
const PPC_PROCINFO_REGISTER_CCR_N: u32 = crate::mixed_mode::proc_info::REGISTER_CCR_N;
const PPC_PROCINFO_REGISTER_CCR_X: u32 = crate::mixed_mode::proc_info::REGISTER_CCR_X;
const PPC_CR0_LT_BIT: u8 = 0;
const PPC_CR0_EQ_BIT: u8 = 2;
const PPC_PROCINFO_SIZE_NONE: u32 = crate::mixed_mode::proc_info::SIZE_NONE;
const PPC_PROCINFO_SIZE_ONE: u32 = crate::mixed_mode::proc_info::SIZE_ONE;
const PPC_PROCINFO_SIZE_TWO: u32 = crate::mixed_mode::proc_info::SIZE_TWO;
const PPC_PROCINFO_SIZE_FOUR: u32 = crate::mixed_mode::proc_info::SIZE_FOUR;
pub(crate) const PPC_LIVE_TRAP_IMPORT_WORDS: &[u16] =
&[0xA973, 0xA974, 0xA975, 0xA976, 0xA977];
const PPC_PROCINFO_MAX_STACK_PARAMETERS: usize = crate::mixed_mode::proc_info::MAX_STACK_PARAMETERS;
const PPC_PROCINFO_MAX_DISPATCHED_STACK_PARAMETERS: usize =
crate::mixed_mode::proc_info::MAX_DISPATCHED_STACK_PARAMETERS;
const PPC_PROCINFO_MAX_REGISTER_PARAMETERS: usize =
crate::mixed_mode::proc_info::MAX_REGISTER_PARAMETERS;
const PPC_CALL_UNIVERSAL_PROC_FIXED_WORD_PARAMETERS: usize = 2;
const PPC_CALL_UNIVERSAL_PROC_REGISTER_VARARGS: usize = 6;
const PPC_NATIVE_PARAMETER_GPR_COUNT: usize = 8;
const PPC_MAX_STACK_SIZE: u32 = PPC_STACK_TOP - PPC_HEAP_BASE;
pub(super) const PPC_RAND_SEED_ADDR: u32 = 0x0000_0156;
const PPC_GRAY_RGN_ADDR: u32 = 0x0000_09ee;
const PPC_DEFAULT_DOUBLE_TIME_TICKS: u32 = 20;
pub(crate) const PPC_RES_CHANGED_ATTR: u16 = 0x0002;
pub(crate) const PPC_RES_PROTECTED_ATTR: u16 = 0x0008;
pub(super) const PPC_RES_PROBLEM: i16 = -204;
const PPC_NO_SCRAP_ERR: i16 = -100;
const PPC_NO_TYPE_ERR: i16 = -102;
const PPC_QUICKTIME_VERSION: u32 = 0x0300_0000;
const PPC_QD3D_VERSION: u32 = 0x0160_8000;
const PPC_MAIN_GDEVICE_RECORD: u32 = 0x02f0_0200;
const PPC_MAIN_GDEVICE_FLAGS: u16 =
(1 << 0) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 15);
const PPC_MAIN_PIXMAP_HANDLE: u32 = 0x02f0_0300;
const PPC_MAIN_PIXMAP: u32 = 0x02f0_0400;
const PPC_GRAY_RGN_HANDLE: u32 = 0x02f0_0500;
const PPC_GRAY_RGN: u32 = 0x02f0_0600;
const PPC_MAIN_DCE_HANDLE: u32 = 0x02f0_0700;
const PPC_MAIN_DCE: u32 = 0x02f0_0800;
pub(crate) const PPC_MAIN_CTABLE_HANDLE: u32 = 0x02f0_0900;
const PPC_MAIN_CTABLE: u32 = 0x02f0_3000;
pub(crate) const PPC_MAIN_CTABLE_SIZE: u32 = 8 + 256 * 8;
const PPC_MAIN_VIS_RGN_HANDLE: u32 = 0x02f0_0b00;
const PPC_MAIN_VIS_RGN: u32 = 0x02f0_0c00;
const PPC_MAIN_CLIP_RGN_HANDLE: u32 = 0x02f0_0d00;
const PPC_MAIN_CLIP_RGN: u32 = 0x02f0_0e00;
const PPC_MAIN_GAMMA_TABLE: u32 = 0x02f0_1000;
const PPC_MAIN_GAMMA_TABLE_SIZE: u32 = 12 + 256;
const PPC_PORT_LIST_HANDLE: u32 = 0x02f0_1300;
const PPC_PORT_LIST: u32 = 0x02f0_1400;
const PPC_UNIT_TABLE: u32 = 0x02f0_1500;
const PPC_SOUND_DCE_HANDLE: u32 = 0x02f0_1600;
const PPC_SOUND_DCE: u32 = 0x02f0_1700;
const PPC_PORT_LIST_ADDR: u32 = 0x0d66;
pub(crate) const PPC_APPLICATION_ZONE: u32 = 0x02f0_2000;
pub(crate) const PPC_SYSTEM_ZONE: u32 = 0x02f0_2100;
const PPC_ZONE_STORAGE_SIZE: usize = 64;
pub(crate) const PPC_ZONE_HEAP_TYPE_OFFSET: u32 = 30;
pub(crate) const PPC_ZONE_32_BIT_HEAP: u8 = 1;
pub(crate) const PPC_ZONE_NEW_STYLE_HEAP: u8 = 2;
pub(super) const PPC_MAIN_SCREEN_BASE: u32 = 0x02a0_0000;
const PPC_MAIN_PIXEL_DEPTH: u32 = REFERENCE_MACHINE_PROFILE.screen_depth as u32;
pub const PPC_QD_TEXT_FONT_DEFAULT: i16 = 0;
pub const PPC_QD_TEXT_MODE_SRC_OR: i16 = 1;
pub const PPC_QD_TEXT_SIZE_SYSTEM: i16 = 0;
const PPC_QD_PEN_MODE_PAT_COPY: i16 = 8;
const PPC_CGRAF_PORT_PN_LOC_OFFSET: u32 = 48;
const PPC_CGRAF_PORT_PN_SIZE_OFFSET: u32 = 52;
const PPC_CGRAF_PORT_PN_MODE_OFFSET: u32 = 56;
const PPC_CGRAF_PORT_PN_VIS_OFFSET: u32 = 66;
const PPC_CGRAF_PORT_VIS_RGN_OFFSET: u32 = 24;
const PPC_CGRAF_PORT_CLIP_RGN_OFFSET: u32 = 28;
const PPC_CGRAF_PORT_GRAF_VARS_OFFSET: u32 = 8;
const PPC_CGRAF_PORT_RGB_FG_COLOR_OFFSET: u32 = 36;
const PPC_CGRAF_PORT_RGB_BK_COLOR_OFFSET: u32 = 42;
const PPC_CGRAF_PORT_BK_PIXPAT_OFFSET: u32 = 32;
const PPC_CGRAF_PORT_TX_FONT_OFFSET: u32 = 68;
const PPC_CGRAF_PORT_TX_FACE_OFFSET: u32 = 70;
const PPC_CGRAF_PORT_TX_MODE_OFFSET: u32 = 72;
const PPC_CGRAF_PORT_TX_SIZE_OFFSET: u32 = 74;
const PPC_CGRAF_PORT_RGN_SAVE_OFFSET: u32 = 96;
const PPC_CGRAF_PORT_PALETTE_HANDLE_OFFSET: u32 = 156;
const PPC_CGRAF_PORT_PALETTE_UPDATES_OFFSET: u32 = 160;
const PPC_GRAF_PORT_SIZE: u32 = 108;
const PPC_GDEVICE_SIZE: u32 = 62;
const PPC_PIXMAP_SIZE: u32 = 50;
const PPC_CGRAF_PORT_SIZE: u32 = 170;
const PPC_KEY_RETURN: u8 = 0x24;
const PPC_KEY_A: u8 = 0x00;
const PPC_KEY_B: u8 = 0x0b;
const PPC_KEY_G: u8 = 0x05;
const PPC_KEY_M: u8 = 0x2e;
const PPC_KEY_Q: u8 = 0x0c;
const PPC_KEY_Z: u8 = 0x06;
const PPC_KEY_1: u8 = 0x12;
const PPC_KEY_2: u8 = 0x13;
const PPC_KEY_EQUAL: u8 = 0x18;
const PPC_KEY_MINUS: u8 = 0x1b;
const PPC_KEY_COMMA: u8 = 0x2b;
const PPC_KEY_PERIOD: u8 = 0x2f;
const PPC_KEY_TAB: u8 = 0x30;
const PPC_KEY_SPACE: u8 = 0x31;
const PPC_KEY_ESCAPE: u8 = 0x35;
const PPC_KEY_COMMAND: u8 = 0x37;
const PPC_KEY_SHIFT: u8 = 0x38;
const PPC_KEY_OPTION: u8 = 0x3a;
const PPC_KEY_CONTROL: u8 = 0x3b;
const PPC_KEY_CONTROL_RIGHT: u8 = 0x3e;
const PPC_KEY_LEFT: u8 = 0x7b;
const PPC_KEY_RIGHT: u8 = 0x7c;
const PPC_KEY_DOWN: u8 = 0x7d;
const PPC_KEY_UP: u8 = 0x7e;
const PPC_KEY_NUMPAD_ADD: u8 = 0x45;
const PPC_KEY_NUMPAD_ENTER: u8 = 0x4c;
const PPC_KEY_NUMPAD_SUBTRACT: u8 = 0x4e;
const PPC_KEY_NUMPAD_LEFT: u8 = 0x56;
const PPC_KEY_NUMPAD_DOWN: u8 = 0x57;
const PPC_KEY_NUMPAD_RIGHT: u8 = 0x58;
const PPC_KEY_NUMPAD_UP: u8 = 0x5b;
const PPC_CONTROL_RECORD_SIZE: u32 = 296;
const PPC_CONTROL_NEXT_OFFSET: u32 = 0;
const PPC_CONTROL_OWNER_OFFSET: u32 = 4;
const PPC_CONTROL_RECT_OFFSET: u32 = 8;
const PPC_CONTROL_VISIBLE_OFFSET: u32 = 16;
const PPC_CONTROL_HILITE_OFFSET: u32 = 17;
const PPC_CONTROL_VALUE_OFFSET: u32 = 18;
const PPC_CONTROL_MIN_OFFSET: u32 = 20;
const PPC_CONTROL_MAX_OFFSET: u32 = 22;
const PPC_CONTROL_ACTION_OFFSET: u32 = 32;
const PPC_CONTROL_REF_CON_OFFSET: u32 = 36;
const PPC_CONTROL_TITLE_OFFSET: u32 = 40;
const PPC_KEY_MAP_SIZE: u32 = 16;
const PPC_GETKEYS_IDLE_POLL_FAST_FORWARD_THRESHOLD: u32 = 4;
const PPC_GETKEYS_IDLE_POLL_EXTRA_CYCLES: u64 = 7_296;
const PPC_MICROSECONDS_IDLE_POLL_FAST_FORWARD_THRESHOLD: u32 =
PPC_GETKEYS_IDLE_POLL_FAST_FORWARD_THRESHOLD;
const PPC_MICROSECONDS_IDLE_POLL_EXTRA_CYCLES: u64 = PPC_GETKEYS_IDLE_POLL_EXTRA_CYCLES;
const PPC_BUTTON_IDLE_POLL_FAST_FORWARD_THRESHOLD: u32 =
PPC_GETKEYS_IDLE_POLL_FAST_FORWARD_THRESHOLD;
const PPC_BUTTON_IDLE_POLL_EXTRA_CYCLES: u64 = PPC_GETKEYS_IDLE_POLL_EXTRA_CYCLES;
const PPC_TICK_COUNT_IDLE_POLL_FAST_FORWARD_THRESHOLD: u32 =
PPC_GETKEYS_IDLE_POLL_FAST_FORWARD_THRESHOLD;
const PPC_MATH_HOT_IMPORT_EXTRA_CYCLES: u64 = 128;
const PPC_DRAW_TEXT_IMPORT_EXTRA_CYCLES: u64 = 768;
const PPC_MEASURE_TEXT_IMPORT_EXTRA_CYCLES: u64 = 256;
const PPC_DRAW_PICTURE_IMPORT_EXTRA_CYCLES: u64 = 2_048;
const PPC_BIT_TRANSFER_IMPORT_EXTRA_CYCLES: u64 = 1_024;
const PPC_DRAW_PRIMITIVE_IMPORT_EXTRA_CYCLES: u64 = 256;
const PPC_RESOURCE_IMPORT_EXTRA_CYCLES: u64 = 128;
const PPC_FIXED_MAC_TIME: u32 = 3_786_912_000;
pub(super) const PPC_MICROSECONDS_PER_TICK: u64 = 16_625;
pub(super) const PPC_QT_GRAPHICS_IMPORTER: u32 = 0x0500_3000;
const PPC_QT_MOVIE: u32 = 0x0500_3010;
pub(super) const PPC_QT_MOVIE_TASKS_PER_SECOND: u64 = 60;
pub(crate) fn ppc_interrupt_callback_stack_pointer(interrupted_sp: u32) -> u32 {
interrupted_sp
.saturating_sub(PPC_INTERRUPT_RED_ZONE_SIZE)
.saturating_sub(PPC_INITIAL_STACK_FRAME_SIZE)
& !0xFu32
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct PpcLoadConfig {
pub stack_size: u32,
pub screen_depth: u32,
}
impl PpcLoadConfig {
pub fn from_cfrg_app_stack_size(app_stack_size: u32) -> Self {
if app_stack_size == 0 {
Self::default()
} else {
Self {
stack_size: app_stack_size,
..Self::default()
}
}
}
}
impl Default for PpcLoadConfig {
fn default() -> Self {
Self {
stack_size: PPC_DEFAULT_STACK_SIZE,
screen_depth: PPC_MAIN_PIXEL_DEPTH,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PpcMath64Operation {
LongDoubleToSInt64,
LongDoubleToUInt64,
S32Set,
S64Absolute,
S64Add,
S64And,
S64BitwiseAnd,
S64BitwiseEor,
S64BitwiseNot,
S64BitwiseOr,
S64Compare,
S64Divide,
S64Eor,
S64Max,
S64Min,
S64Multiply,
S64Negate,
S64Not,
S64Or,
S64Set,
S64SetU,
S64ShiftLeft,
S64ShiftRight,
S64Subtract,
SInt64ToLongDouble,
SInt64ToUInt64,
U32SetU,
U64Add,
U64And,
U64BitwiseAnd,
U64BitwiseEor,
U64BitwiseNot,
U64BitwiseOr,
U64Compare,
U64Divide,
U64Eor,
U64Max,
U64Multiply,
U64Not,
U64Or,
U64Set,
U64SetU,
U64ShiftLeft,
U64ShiftRight,
U64Subtract,
UInt64ToLongDouble,
UInt64ToSInt64,
}
pub use math_compatibility::PpcMathCompatibilityOperation;
pub use dispatch_stdc::PpcStdCCompatibilityOperation;
pub use sound::{PpcSoundInputCompatibilityOperation, PpcSpeechCompatibilityOperation};
pub use dispatch_standard_file::PpcStandardFileOperation;
pub use dispatch_dialog::PpcDialogCompatibilityOperation;
pub use dispatch_quickdraw::PpcQuickDrawCompatibilityOperation;
pub use dispatch_appletalk::PpcAppleTalkCompatibilityOperation;
#[cfg(test)]
pub(super) use dispatch_appletalk::ppc_dispatch_appletalk_compatibility;
pub use dispatch_printing::PpcPrintingCompatibilityOperation;
#[cfg(test)]
pub(super) use dispatch_printing::ppc_dispatch_printing_compatibility;
pub use dispatch_files::PpcFileCompatibilityOperation;
pub use files::{PpcDeleteByNameOperation, PpcParameterBlockCreateOperation};
pub use memory::PpcLegacyMemoryUtilityOperation;
pub use dispatch_window::PpcLegacyWindowOperation;
pub use dispatch_control::PpcLegacyControlOperation;
pub use dispatch_inputsprocket::PpcInputSprocketCompatibilityOperation;
pub use dispatch_apple_events::PpcAppleEventCompatibilityOperation;
pub use dispatch_event::PpcEventPollOperation;
pub use dispatch_collection::PpcCollectionOperation;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PpcImportDispatcherTarget {
Collection(PpcCollectionOperation),
InstallExceptionHandler,
NewPtr { clear: bool },
DisposePtr,
GetPtrSize,
SetPtrSize,
RecoverHandle,
BlockMove,
BlockZero,
PtrToHand,
PtrToXHand,
HandToHand,
HandAndHand,
NewHandle { clear: bool },
TempNewHandle,
TempDisposeHandle,
HoldMemory,
UnholdMemory,
DisposeHandle,
EmptyHandle,
GetHandleSize,
SetHandleSize,
HLock,
HLockHi,
HGetState,
HSetState,
HUnlock,
MoveHHi,
HNoPurge,
HPurge,
TickCount,
GetZone,
SetZone,
InitZone,
SystemZone,
ApplicationZone,
MaxApplZone,
MoreMasters,
FlushCodeCache,
GetApplLimit,
SetApplLimit,
HeapFreeBytes,
MaxMem,
PurgeMem,
PurgeMemSys,
MemError,
CurResFile,
UseResFile,
CloseResFile,
OpenResFile,
HOpenResFile,
ResError,
SetResLoad,
LMGetResLoad,
LoadResource,
GetIndString,
GetString,
GetResource,
Get1Resource,
GetNamedResource,
Get1NamedResource,
GetIndResource,
Get1IndResource,
GetResAttrs,
SetResAttrs,
GetResInfo,
GetResourceSizeOnDisk,
SetResInfo,
HomeResFile,
CountResources,
Count1Resources,
CountTypes,
Count1Types,
GetIndType,
Get1IndType,
UniqueID,
Unique1ID,
UpdateResFile,
AddResource,
ChangedResource,
WriteResource,
RemoveResource,
ReleaseResource,
DetachResource,
ReadPartialResource,
GetPicture,
GetIcon,
GetIconSuite,
GetPattern,
GetIndPattern,
GetPixPat,
GetPictInfo,
DrawPicture,
KillPicture,
Gestalt,
NewGestaltValue,
RegisterAppearanceClient,
ActivateControl,
DeactivateControl,
IsControlActive,
CollapseWindow,
IsWindowCollapsed,
UnregisterAppearanceClient,
SetControlFontStyle,
GetSharedLibrary,
FindSymbol,
CountSymbols,
GetIndSymbol,
CloseConnection,
GetMemFragment,
GetDiskFragment,
InitCursor,
GetQDGlobalsArrow,
HideCursor,
ShowCursor,
ShieldCursor,
CrsrDevNextDevice,
CrsrDevMoveTo,
GetCursor,
SetCursor,
GetCCursor,
GetCIcon,
PlotCIcon,
DisposeCIcon,
SetCCursor,
DisposeCCursor,
SysBeep,
GetForeColor,
GetBackColor,
ForeColor,
BackColor,
RGBForeColor,
RGBBackColor,
OpColor,
HiliteColor,
PmForeColor,
PmBackColor,
Color2Index,
Index2Color,
RGB2HSL,
RGB2HSV,
HSV2RGB,
FixRatio,
FixMul,
FixDiv,
Long2Fix,
Fix2Long,
FixRound,
Fix2Frac,
Frac2Fix,
Frac2X,
X2Frac,
FracSin,
FracCos,
FracSqrt,
FracMul,
FracDiv,
FixATan2,
WideAdd,
WideSubtract,
WideNegate,
WideShift,
WideBitShift,
WideMultiply,
WideDivide,
WideWideDivide,
WideSquareRoot,
WideCompare,
MoveTo,
Move,
LineTo,
Line,
DrawChar,
DrawText,
DrawString,
TextFont,
TextFace,
TextMode,
TextSize,
PaintRect,
EraseRect,
InvertRect,
FrameRect,
FillRect,
FrameOval,
PaintOval,
EraseOval,
PaintArc,
FrameRgn,
PaintRgn,
FillRgn,
InvertRgn,
FillCRect,
FrameRoundRect,
PaintRoundRect,
InvalRect,
ValidRect,
BeginUpdate,
EndUpdate,
ClipRect,
GetClip,
SetClip,
GetPen,
HidePen,
ShowPen,
PenSize,
PenMode,
PenNormal,
PenPixPat,
GetPenState,
SetPenState,
CopyBits,
BitMapToRegion,
NewRgn,
DisposeRgn,
CopyRgn,
OpenRgn,
CloseRgn,
SectRgn,
UnionRgn,
DiffRgn,
XorRgn,
SetEmptyRgn,
SetRectRgn,
RectRgn,
OffsetRgn,
EmptyRgn,
PtInRgn,
RectInRgn,
OpenPoly,
ClosePoly,
KillPoly,
PaintPoly,
FramePoly,
FillPoly,
NewCWindow,
GetNewCWindow,
GetWRefCon,
SetWRefCon,
SizeWindow,
MoveWindow,
ShowWindow,
HideWindow,
ShowHide,
CloseWindow,
SelectWindow,
FrontWindow,
SetWinColor,
PaintOne,
PaintBehind,
CalcVisBehind,
GetMouse,
ActivatePalette,
NSetPalette,
GetPalette,
GetPort,
GetWMgrPort,
SetPort,
GetGDevice,
SetGDevice,
GetDeviceList,
GetNextDevice,
GetMainDevice,
GetMaxDevice,
GetSysFont,
GetAppFont,
GetDefFontSize,
GetFontName,
GetMBarHeight,
SetMBarHeight,
NewMenu,
DisposeMenu,
GetMenu,
GetItemCmd,
SetItemCmd,
GetItemMark,
CountMItems,
GetMenuItemText,
SetMenuItemText,
DeleteMenuItem,
CalcMenuSize,
PopUpMenuSelect,
InsertMenu,
DeleteMenu,
AppendMenu,
InsertMenuItem,
AppendResMenu,
InsertResMenu,
EnableMenuItem,
DisableMenuItem,
SetItemMark,
CheckItem,
GetMenuBar,
GetNewMBar,
LMGetMenuList,
LMSetMenuHook,
LMGetMenuFlash,
LMGetPaintWhite,
LMGetSysMap,
LMGetCurApRefNum,
GetVCBQHdr,
LMGetSysEvtMask,
LMSetSysEvtMask,
LMGetDefltStack,
LMGetCurStackBase,
LMSetPaintWhite,
LMSetResumeProc,
LMSetACount,
LMSetANumber,
LMSetDlgFont,
SetMenuFlash,
ClearMenuBar,
InvalMenuBar,
SetMenuBar,
GetMenuHandle,
DrawMenuBar,
FlashMenuBar,
HMGetHelpMenuHandle,
HMGetBalloons,
HiliteMenu,
DrawGrowIcon,
MenuNoop,
MenuKey,
MenuEvent,
MenuChoice,
MenuSelect,
TestDeviceAttribute,
SetDeviceAttribute,
HasDepth,
SetDepth,
NewGWorld,
UpdateGWorld,
DisposeGWorld,
GetCTable,
GetCTSeed,
MakeITable,
QDError,
CTabChanged,
ProtectEntry,
ReserveEntry,
RestoreEntries,
SetEntries,
RestoreDeviceClut,
DisposeCTable,
NewPixMap,
DisposePixMap,
GetGWorld,
SetGWorld,
GetWindowPort,
SetPortWindowPort,
GetGWorldDevice,
GetGWorldPixMap,
OpenPort,
OpenCPort,
CloseCPort,
SetPortBits { color: bool },
GetPixBaseAddr,
GetPixRowBytes,
LockPixels,
UnlockPixels,
GetPixelsState,
SetPixelsState,
AllowPurgePixels,
NoPurgePixels,
SetRect,
SectRect,
UnionRect,
EqualRect,
EmptyRect,
SetPt,
EqualPt,
AddPt,
SubPt,
LocalToGlobal,
GlobalToLocal,
PtInRect,
SetOrigin,
OffsetRect,
MapRect,
InsetRect,
FindWindow,
GetGrayRgn,
LMSetGrayRgn,
GetDCtlEntry,
GetADBInfo,
OpenDriver,
Control,
PBControl,
PBStatus,
FindFolder,
NewAlias,
NewAliasMinimalFromFullPath,
UpdateAlias,
ResolveAlias,
ResolveAliasFile,
ResolveAliasFileWithMountFlags,
GetIconRefFromFile,
GetIconRef,
PlotIconRef,
ReleaseIconRef,
DirCreate,
FSpDirCreate,
FSMakeFSSpec,
PBGetFInfo,
PBHGetFInfo,
PBSetFInfo,
PBHSetFInfo,
PBGetCatInfo,
PBSetCatInfo,
PBHGetVInfo,
GetVInfo,
PBDTGetPath,
PBDTGetCommentSync,
PBGetFCBInfo,
FSpGetFInfo,
GetFInfo,
HGetFInfo,
FSpSetFInfo,
HSetFInfo,
StandardGetFile,
GetScrap,
PutScrap,
ZeroScrap,
LoadScrap,
UnloadScrap,
SndSoundManagerVersion,
UnsignedFixedMulDiv,
GetSoundOutputInfo,
GetCompressionInfo,
GetSoundVol,
SetSoundVol,
GetDefaultOutputVolume,
SetDefaultOutputVolume,
GetVol,
GetWDInfo,
HGetVol,
HSetVol,
FlushVol,
PBFlushVol,
SndNewChannel,
SndDisposeChannel,
SndPlay,
SndChannelStatus,
SndGetInfo,
SndSetInfo,
ParseSndHeader,
SndDoCommand,
SndDoImmediate,
SndPlayDoubleBuffer,
SndStartFilePlay,
SndPauseFilePlay,
SndStopFilePlay,
GetSoundHeaderOffset,
FSpCreateResFile,
HCreateResFile,
FSpOpenDF,
FSpOpenRF,
PBOpen,
PBHOpenDF,
HOpen,
FSOpen,
FSpOpenResFile,
FSClose,
PBClose,
PBFlushFile,
FSRead,
PBRead,
FSWrite,
PBWrite,
GetEOF,
PBGetEOF,
SetEOF,
AllocContig,
PBSetEOF,
GetFPos,
SetFPos,
PBSetFPos,
FSpCreate,
PBCreate(PpcParameterBlockCreateOperation),
FSpDelete,
DeleteByName(PpcDeleteByNameOperation),
HCreate,
HRename,
Create,
DSpGetFirstContext,
DSpGetNextContext,
DSpFindBestContext,
DSpFindBestContextOnDisplayID,
DSpUserSelectContext,
DSpStartup,
DSpGetVersion,
DSpShutdown,
DSpProcessEvent,
DSpBlitFastest,
DSpCanUserSelectContext,
DSpGetMouse,
DSpFindContextFromPoint,
DSpContextGlobalToLocal,
DSpContextLocalToGlobal,
DSpSetBlankingColor,
DSpAltBufferNew,
DSpAltBufferGetCGrafPtr,
DSpContextReserve,
DSpContextRelease,
DSpContextSetState,
DSpContextGetState,
DSpContextFadeGamma,
DSpContextFadeGammaIn,
DSpContextFadeGammaOut,
DSpContextGetFrontBuffer,
DSpContextGetBackBuffer,
DSpContextSwapBuffers,
DSpContextSetClutEntries,
DSpContextGetDisplayID,
DSpContextGetAttributes,
DSpContextSetVblProc,
DSpContextIsBusy,
DSpAltBufferDispose,
DSpContextInvalBackBufferRect,
DSpContextSetUnderlayAltBuffer,
DMGetDisplayIDByGDevice,
DMGetNameByAVID,
DMGetGDeviceByDisplayID,
GetNewDialog,
NewDialog,
NewFeaturesDialog,
GetDialogItem,
GetDialogItemAsControl,
SetDialogItem,
GetDialogItemText,
SetDialogItemText,
SetDialogDefaultItem,
SetDialogCancelItem,
SetDialogTracksCursor,
StdFilterProc,
DrawDialog,
DrawControls,
ModalDialog,
SetControlTitle,
SetControlValue,
HiliteControl,
InitGraf,
InitFonts,
InitWindows,
InitMenus,
TEInit,
TENew,
TEStyleNew,
TESetStyle,
TEUseStyleScrap,
TEContinuousStyle,
MeasureText,
TEGetText,
TEDispose,
TEActivate { active: bool },
TESetSelect,
TESetText,
TECalText,
TEInsert { styled: bool },
TEDelete,
TEKey,
TEClick,
TEIdle,
TEUpdate,
TETextBox,
TESetAlignment,
TEGetHeight,
TEGetPoint,
TEScroll { pinned: bool },
TEAutoView,
TECopy { cut: bool, dialog: bool },
TEPaste { dialog: bool },
TETransferScrap { from_desktop: bool },
TEScrapHandle,
TEScrapLength { set: bool },
SelectDialogItemText,
InitDialogs,
SystemTask,
SystemClick,
OpenDeskAcc,
AEInstallEventHandler,
AEProcessAppleEvent,
LNew,
LDispose,
LAddRow,
LDelRow,
LGetSelect,
LSetSelect,
LSetCell,
LGetCell,
LClick,
LActivate,
LSetDrawingMode,
LScroll,
LSize,
LUpdate,
LAutoScroll,
LSearch,
FlushEvents,
SetEventMask,
CloseDialog,
DisposeDialog,
GetNextEvent(PpcEventPollOperation),
GetOSEvent,
EventAvail,
OSEventAvail,
PostEvent,
Button,
StillDown,
WaitMouseUp,
GetKeys,
GetDateTime,
ReadDateTime,
ReadLocation,
GetTime,
Delay,
GetDblTime,
LMGetTime,
LMGetUTableBase,
SecondsToDate,
Microseconds,
AbsoluteToNanoseconds,
SysEnvirons,
TextWidth,
StringWidth,
TruncString,
CharWidth,
RealFont,
GetFontInfo,
FontMetrics,
GetFNum,
GetIntlResource,
AESetInteractionAllowed,
AEGetInteractionAllowed,
LMGetCurDirStore,
LMSetCurDirStore,
LMGetSFSaveDisk,
LMSetSFSaveDisk,
LMGetRndSeed,
LMSetRndSeed,
SetCurrentA5,
SetA5,
SVersion,
DMGetFirstScreenDevice,
DMGetNextScreenDevice,
DMGetDisplayMode,
DMCheckDisplayMode,
DMSetDisplayMode,
DMNewDisplayModeList,
DMGetIndexedDisplayModeFromList,
DMDisposeList,
DMBeginConfigureDisplays,
DMEndConfigureDisplays,
SetToolTrapAddress,
SetOSTrapAddress,
NSetTrapAddress,
EqualString,
IUEqualPString,
NumToString,
StringToNum,
Random,
BitAnd,
BitOr,
BitTst,
StdMemset,
StdMemcmp,
StdMemcpy,
StdMemmove,
StdMalloc,
StdFree,
StdCalloc,
StdRealloc,
StdStrcpy,
StdStrcat,
StdStrncpy,
StdStrncat,
StdStrcmp,
StdStrncmp,
StdStrlen,
StdMemchr,
StdStrchr,
StdStrrchr,
StdStrspn,
StdStrcspn,
StdStrpbrk,
StdStrstr,
StdAtoi,
StdGetenv,
StdSprintf,
StdIoCompatibility(PpcStdIoOperation),
StdAbs,
StdToupper,
StdTolower,
StdIsalnum,
StdIsalpha,
StdIsascii,
StdIscntrl,
StdIsdigit,
StdIsgraph,
StdIslower,
StdIsprint,
StdIspunct,
StdIsspace,
StdIsupper,
StdIsxdigit,
StdToascii,
StdSrand,
StdRand,
StdTime,
P2CStr,
C2PStr,
CopyCStringToPascal,
CopyPascalStringToC,
CfStringMakeConstantString,
CfStringCreateWithCString,
CfStringCreateWithPascalString,
CfStringCreateWithBytes,
CfStringGetCString,
CfStringGetBytes,
CfStringGetLength,
CfStringGetSystemEncoding,
CfRetain,
CfRelease,
CfGetRetainCount,
CfBundleGetBundleWithIdentifier,
UpperText,
GetCurrentThread,
NewThreadEntryUPP,
DisposeThreadEntryUPP,
NewThreadTerminationUPP,
DisposeThreadTerminationUPP,
NewThreadSwitchUPP,
DisposeThreadSwitchUPP,
SetThreadTerminator,
SetThreadSwitcher,
GetThreadState,
GetThreadCurrentTaskRef,
GetThreadStateGivenTaskRef,
SetThreadReadyGivenTaskRef,
SetThreadState,
SetThreadStateEndCritical,
ThreadBeginCritical,
NewThread,
CreateThreadPool,
GetFreeThreadCount,
GetSpecificFreeThreadCount,
GetDefaultThreadStackSize,
ThreadCurrentStackSpace,
YieldToThread,
YieldToAnyThread,
DisposeThread,
ThreadEndCritical,
GetCurrentProcess,
WakeUpProcess,
SameProcess,
GetProcessInformation,
ParamText,
AlertReturnDefault,
StandardAlert,
ExitToShell,
MathCeil,
MathSqrt,
MathExp,
MathSin,
MathCos,
MathAsin,
MathTan,
MathAtan,
MathAtan2,
MathPow,
MathFmod,
MathLog,
MathLog10,
MathDtox80,
Math64(PpcMath64Operation),
X2Fix,
Q3MemoryStorageNew,
Q3MemoryStorageNewBuffer,
Q3FSSpecStorageNew,
Q3MemoryStorageSet,
Q3MemoryStorageGetBuffer,
Q3MemoryStorageSetBuffer,
Q3MemoryStorageGetType,
Q3NewObject,
Q3FileNew,
Q3ViewNew,
Q3Initialize,
Q3Exit,
Q3GetVersion,
Q3DisplayGroupNew,
Q3OrderedDisplayGroupNew,
Q3ErrorGet,
Q3ObjectDispose,
Q3ObjectDuplicate,
Q3SharedGetReference,
Q3SharedIsReferenced,
Q3SharedGetType,
Q3ShapeGetType,
Q3ShapeGetLeafType,
Q3ObjectIsDrawable,
Q3ObjectIsType,
Q3ObjectGetType,
Q3ObjectGetLeafType,
Q3GeometryGetType,
Q3ShaderGetType,
Q3GroupGetType,
Q3RendererNewFromType,
Q3RendererGetType,
Q3RendererSync,
Q3RendererFlush,
Q3InteractiveRendererSetDoubleBufferBypass,
Q3InteractiveRendererSetPreferences,
Q3InteractiveRendererSetRaveContextHints,
Q3InteractiveRendererGetRaveContextHints,
Q3InteractiveRendererGetRaveDrawContexts,
Q3InteractiveRendererSetRaveTextureFilter,
Q3TextureShaderNew,
Q3TextureShaderGetTexture,
Q3LambertIlluminationNew,
Q3NullIlluminationNew,
Q3PhongIlluminationNew,
Q3MipmapTextureNew,
Q3MipmapTextureGetMipmap,
Q3ViewAngleAspectCameraNew,
Q3OrthographicCameraNew,
Q3ViewPlaneCameraNew,
Q3CameraGetPlacement,
Q3CameraSetPlacement,
Q3CameraGetRange,
Q3CameraSetRange,
Q3CameraGetViewPort,
Q3CameraSetViewPort,
Q3CameraGetWorldToView,
Q3CameraGetViewToFrustum,
Q3LightGetType,
Q3LightGetState,
Q3LightSetState,
Q3LightGetBrightness,
Q3LightSetBrightness,
Q3LightGetColor,
Q3LightSetColor,
Q3LightGetData,
Q3LightSetData,
Q3AmbientLightNew,
Q3AmbientLightGetData,
Q3AmbientLightSetData,
Q3DirectionalLightNew,
Q3DirectionalLightGetCastShadowsState,
Q3DirectionalLightSetCastShadowsState,
Q3DirectionalLightGetDirection,
Q3DirectionalLightSetDirection,
Q3DirectionalLightGetData,
Q3DirectionalLightSetData,
Q3PointLightNew,
Q3PointLightGetCastShadowsState,
Q3PointLightSetCastShadowsState,
Q3PointLightGetAttenuation,
Q3PointLightSetAttenuation,
Q3PointLightGetLocation,
Q3PointLightSetLocation,
Q3PointLightGetData,
Q3PointLightSetData,
Q3SpotLightNew,
Q3SpotLightGetCastShadowsState,
Q3SpotLightSetCastShadowsState,
Q3SpotLightGetAttenuation,
Q3SpotLightSetAttenuation,
Q3SpotLightGetLocation,
Q3SpotLightSetLocation,
Q3SpotLightGetDirection,
Q3SpotLightSetDirection,
Q3SpotLightGetHotAngle,
Q3SpotLightSetHotAngle,
Q3SpotLightGetOuterAngle,
Q3SpotLightSetOuterAngle,
Q3SpotLightGetFallOff,
Q3SpotLightSetFallOff,
Q3SpotLightGetData,
Q3SpotLightSetData,
Q3LightGroupNew,
Q3ShaderGetUVTransform,
Q3ShaderSetUVTransform,
Q3ShaderGetUBoundary,
Q3ShaderSetUBoundary,
Q3ShaderGetVBoundary,
Q3ShaderSetVBoundary,
Q3BackfacingStyleNew,
Q3BackfacingStyleGet,
Q3BackfacingStyleSet,
Q3InterpolationStyleNew,
Q3InterpolationStyleGet,
Q3InterpolationStyleSet,
Q3FillStyleNew,
Q3FillStyleGet,
Q3FillStyleSet,
Q3OrientationStyleNew,
Q3OrientationStyleGet,
Q3OrientationStyleSet,
Q3TriMeshNew,
Q3TriMeshGetData,
Q3TriMeshSetData,
Q3TriMeshEmptyData,
Q3AttributeSetNew,
Q3AttributeSetAdd,
Q3AttributeSetGet,
Q3AttributeSetClear,
Q3AttributeSetContains,
Q3AttributeSetGetNextAttributeType,
Q3StorageGetSize,
Q3StorageGetData,
Q3StorageSetData,
Q3StorageGetType,
Q3PixmapDrawContextNew,
Q3MacDrawContextNew,
Q3DrawContextGetPane,
Q3Vector3DNormalize,
Q3Vector3DLength,
Q3Vector2DNormalize,
Q3Vector3DCross,
Q3Point2DDistance,
Q3Point3DDistance,
Q3Point3DCrossProductTri,
Q3BoundingBoxSetFromPoints3D,
Q3Matrix3x3SetTranslate,
Q3Matrix4x4SetIdentity,
Q3Matrix4x4SetTranslate,
Q3Matrix4x4SetScale,
Q3Matrix4x4SetRotateX,
Q3Matrix4x4SetRotateY,
Q3Matrix4x4SetRotateZ,
Q3Matrix4x4SetRotateXyz,
Q3Matrix4x4Multiply,
Q3Matrix4x4Transpose,
Q3Matrix4x4Invert,
Q3Point3DTransform,
Q3Point3DTo3DTransformArray,
Q3Point3DTo4DTransformArray,
Q3Vector3DTransform,
Q3MatrixTransformNew,
Q3MatrixTransformSet,
Q3TransformGetMatrix,
Q3FileSetStorage,
Q3FileOpenRead,
Q3FileReadObject,
Q3FileIsEndOfFile,
Q3FileClose,
Q3GroupAddObject,
Q3GroupAddObjectBefore,
Q3GroupCountObjects,
Q3GroupGetFirstPosition,
Q3GroupGetNextPosition,
Q3GroupGetFirstPositionOfType,
Q3GroupGetPositionObject,
Q3GroupRemovePosition,
Q3ViewSetRenderer,
Q3ViewGetRenderer,
Q3ViewSetLightGroup,
Q3ViewGetLightGroup,
Q3ViewSetDrawContext,
Q3ViewGetDrawContext,
Q3ViewSetCamera,
Q3ViewGetCamera,
Q3ViewGetWorldToFrustumMatrixState,
Q3ViewGetFrustumToWindowMatrixState,
Q3ViewStartRendering,
Q3ViewEndRendering,
Q3ViewStartBoundingBox,
Q3ViewEndBoundingBox,
Q3ViewStartBoundingSphere,
Q3ViewEndBoundingSphere,
Q3ViewCancel,
Q3ShaderSubmit,
Q3StyleSubmit,
Q3BackfacingStyleSubmit,
Q3InterpolationStyleSubmit,
Q3FillStyleSubmit,
Q3OrientationStyleSubmit,
Q3FogStyleSubmit,
Q3TriMeshSubmit,
Q3MatrixTransformSubmit,
Q3ResetTransformSubmit,
Q3PushSubmit,
Q3PopSubmit,
Q3ObjectSubmit,
QADeviceGetFirstEngine,
QADeviceGetNextEngine,
QAEngineGestalt,
ISpElementNewVirtualFromNeeds,
ISpElementListNew,
ISpElementListAddElements,
ISpElementListGetNextEvent,
ISpElementListFlush,
ISpDevicesExtract,
ISpDevicesExtractByClass,
ISpDeviceGetDefinition,
ISpDeviceGetElementList,
ISpElementListExtract,
ISpElementGetInfo,
ISpElementGetSimpleState,
ISpGetVersion,
ISpStartup,
ISpShutdown,
ISpInit,
ISpStop,
ISpSuspend,
ISpResume,
ISpDevicesActivate,
ISpDevicesDeactivate,
ISpConfigure,
GlideSstQueryBoards,
QtEnterMovies,
QtExitMovies,
QtGetMoviesError,
QtGetMoviesStickyError,
QtClearMoviesStickyError,
QtGetGraphicsImporterForFile,
QtOpenADefaultComponent,
QtGraphicsImportSetDataHandle,
QtGraphicsImportGetImageDescription,
QtGraphicsImportGetBoundsRect,
QtGraphicsImportSetGWorld,
QtGraphicsImportDraw,
QtOpenMovieFile,
QtNewMovieFromFile,
QtGetMovieBox,
QtSetMovieBox,
QtSetMovieGWorld,
QtStartMovie,
QtStopMovie,
QtMoviesTask,
QtDisposeMovie,
QtIsMovieDone,
QtGoToBeginningOfMovie,
QtGoToEndOfMovie,
QtGetMovieDuration,
QtLoadMovieIntoRam,
QtCloseMovieFile,
CloseComponent,
NewRoutineDescriptor,
NewIOCompletionUPP,
DisposeIOCompletionUPP,
NewControlUserPaneDrawUPP,
DisposeControlUserPaneDrawUPP,
NewAEEventHandlerUPP,
DisposeAEEventHandlerUPP,
NewFatRoutineDescriptor,
DisposeRoutineDescriptor,
CallUniversalProc,
CallOSTrapUniversalProc,
NGetTrapAddress,
GetToolTrapAddress,
GetOSTrapAddress,
LMGetCurrentA5,
InsTime,
InsXTime,
PrimeTime,
RmvTime,
VInstall,
VRemove,
SlotVInstall,
SlotVRemove,
LegacyMemoryUtility(PpcLegacyMemoryUtilityOperation),
LegacyControl(PpcLegacyControlOperation),
LegacyWindow(PpcLegacyWindowOperation),
AppleEventCompatibility(PpcAppleEventCompatibilityOperation),
DialogCompatibility(PpcDialogCompatibilityOperation),
QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation),
SystemCompatibility(PpcSystemCompatibilityOperation),
FileCompatibility(PpcFileCompatibilityOperation),
AppleTalkCompatibility(PpcAppleTalkCompatibilityOperation),
PrintingCompatibility(PpcPrintingCompatibilityOperation),
SlotCompatibility,
StandardFileCompatibility(PpcStandardFileOperation),
SoundInputCompatibility(PpcSoundInputCompatibilityOperation),
SpeechCompatibility(PpcSpeechCompatibilityOperation),
QuickTimeCompatibility(PpcQuickTimeCompatibilityOperation),
InputSprocketCompatibility(PpcInputSprocketCompatibilityOperation),
MathCompatibility(PpcMathCompatibilityOperation),
StdCCompatibility(PpcStdCCompatibilityOperation),
ObjectSupportCompatibility,
ReturnError(i16),
ReturnNoErr,
ReturnOne,
NoOpPreserve,
UnresolvedWeak,
Unsupported,
}
pub type PpcQueuedEvent = QueuedEvent;
struct PpcHleFetchObserver<'a> {
histogram: Option<&'a mut PpcFetchHistogram>,
trace_fetches: bool,
trace_pc_range: Option<(u32, u32)>,
}
impl PpcFetchObserver for PpcHleFetchObserver<'_> {
fn on_fetch(&mut self, pc: u32, word: u32) {
if self.trace_fetches
|| self
.trace_pc_range
.map(|(start, end)| pc >= start && pc <= end)
.unwrap_or(false)
{
eprintln!("{}", format_ppc_trace_fetch(pc, word));
}
if let Some(histogram) = self.histogram.as_deref_mut() {
histogram.on_fetch(pc, word);
}
}
fn on_fetch_cpu(&mut self, cpu: &PpcCpu, word: u32) {
let pc = cpu.pc;
let in_range = self
.trace_pc_range
.map(|(start, end)| pc >= start && pc <= end)
.unwrap_or(false);
let r27_matches = ppc_trace_regs_r27_filter()
.map(|expected| cpu.gpr[27] == expected)
.unwrap_or(true);
let r3_matches = ppc_trace_regs_r3_filter()
.map(|expected| cpu.gpr[3] == expected)
.unwrap_or(true);
if ppc_trace_regs_enabled() && in_range && r27_matches && r3_matches {
eprintln!(
"[PPC-TRACE] fetch pc=${:08X} word=${:08X} lr=${:08X} sp=${:08X} rtoc=${:08X} r3=${:08X} r4=${:08X} r5=${:08X} r12=${:08X} r27=${:08X} r28=${:08X} r29=${:08X} r30=${:08X} r31=${:08X}",
pc,
word,
cpu.lr,
cpu.gpr[1],
cpu.gpr[2],
cpu.gpr[3],
cpu.gpr[4],
cpu.gpr[5],
cpu.gpr[12],
cpu.gpr[27],
cpu.gpr[28],
cpu.gpr[29],
cpu.gpr[30],
cpu.gpr[31],
);
if let Some(histogram) = self.histogram.as_deref_mut() {
histogram.on_fetch(pc, word);
}
return;
}
if ppc_trace_regs_enabled() && in_range {
if let Some(histogram) = self.histogram.as_deref_mut() {
histogram.on_fetch(pc, word);
}
return;
}
self.on_fetch(pc, word);
}
}
static PPC_TRACE_ENABLED: OnceLock<bool> = OnceLock::new();
static PPC_TRACE_PC_RANGE: OnceLock<Option<(u32, u32)>> = OnceLock::new();
static PPC_HLE_TRACE_ENABLED: OnceLock<bool> = OnceLock::new();
static PPC_GWORLD_TRACE_ENABLED: OnceLock<bool> = OnceLock::new();
static QD3D_TRACE_ENABLED: OnceLock<bool> = OnceLock::new();
static QD3D_TRIMESH_TRACE_ENABLED: OnceLock<bool> = OnceLock::new();
static QD3D_COLLISION_TRACE_ENABLED: OnceLock<bool> = OnceLock::new();
static QD3D_DUMP_FRAME_ENABLED: OnceLock<bool> = OnceLock::new();
static QT_TRACE_ENABLED: OnceLock<bool> = OnceLock::new();
static PPC_SOUND_TRACE_ENABLED: OnceLock<bool> = OnceLock::new();
static PPC_TIMER_TRACE_ENABLED: OnceLock<bool> = OnceLock::new();
static PPC_PT_IN_RECT_TRACE_ENABLED: OnceLock<bool> = OnceLock::new();
static PPC_RECENT_IMPORTS_ON_HALT_ENABLED: OnceLock<bool> = OnceLock::new();
static PPC_TRACE_REGS_ENABLED: OnceLock<bool> = OnceLock::new();
static PPC_TRACE_REGS_R27_FILTER: OnceLock<Option<u32>> = OnceLock::new();
static PPC_TRACE_REGS_R3_FILTER: OnceLock<Option<u32>> = OnceLock::new();
fn ppc_trace_enabled() -> bool {
*PPC_TRACE_ENABLED.get_or_init(|| std::env::var_os("SYSTEMLESS_PPC_TRACE").is_some())
}
fn ppc_trace_pc_range() -> Option<(u32, u32)> {
*PPC_TRACE_PC_RANGE.get_or_init(|| {
let value = std::env::var("SYSTEMLESS_PPC_TRACE_PC_RANGE").ok()?;
let mut parts = value.split(':');
let start = parts.next()?.trim();
let end = parts.next()?.trim();
let parse = |s: &str| u32::from_str_radix(s.trim_start_matches("0x"), 16).ok();
Some((parse(start)?, parse(end)?))
})
}
fn ppc_trace_regs_enabled() -> bool {
*PPC_TRACE_REGS_ENABLED.get_or_init(|| std::env::var_os("SYSTEMLESS_PPC_TRACE_REGS").is_some())
}
fn ppc_trace_regs_r27_filter() -> Option<u32> {
*PPC_TRACE_REGS_R27_FILTER.get_or_init(|| {
let value = std::env::var("SYSTEMLESS_PPC_TRACE_REGS_R27").ok()?;
let trimmed = value.trim();
let hex = trimmed
.strip_prefix("0x")
.or_else(|| trimmed.strip_prefix("0X"))
.or_else(|| trimmed.strip_prefix('$'))
.unwrap_or(trimmed);
u32::from_str_radix(hex, 16).ok()
})
}
fn ppc_trace_regs_r3_filter() -> Option<u32> {
*PPC_TRACE_REGS_R3_FILTER.get_or_init(|| {
let value = std::env::var("SYSTEMLESS_PPC_TRACE_REGS_R3").ok()?;
let trimmed = value.trim();
let hex = trimmed
.strip_prefix("0x")
.or_else(|| trimmed.strip_prefix("0X"))
.or_else(|| trimmed.strip_prefix('$'))
.unwrap_or(trimmed);
u32::from_str_radix(hex, 16).ok()
})
}
pub(super) fn ppc_hle_trace_enabled() -> bool {
*PPC_HLE_TRACE_ENABLED.get_or_init(|| std::env::var_os("SYSTEMLESS_PPC_HLE_TRACE").is_some())
}
pub(super) fn ppc_gworld_trace_enabled() -> bool {
*PPC_GWORLD_TRACE_ENABLED
.get_or_init(|| std::env::var_os("SYSTEMLESS_PPC_GWORLD_TRACE").is_some())
}
fn ppc_recent_imports_on_halt_enabled() -> bool {
*PPC_RECENT_IMPORTS_ON_HALT_ENABLED
.get_or_init(|| std::env::var_os("SYSTEMLESS_PPC_RECENT_IMPORTS_ON_HALT").is_some())
}
pub(super) fn ppc_res_type_text(res_type: u32) -> String {
let bytes = res_type.to_be_bytes();
if bytes
.iter()
.all(|byte| byte.is_ascii_graphic() || *byte == b' ')
{
String::from_utf8_lossy(&bytes).into_owned()
} else {
format!("${res_type:08X}")
}
}
fn qd3d_trace_enabled() -> bool {
*QD3D_TRACE_ENABLED.get_or_init(|| std::env::var_os("SYSTEMLESS_QD3D_TRACE").is_some())
}
pub(crate) fn qd3d_trimesh_trace_enabled() -> bool {
*QD3D_TRIMESH_TRACE_ENABLED
.get_or_init(|| std::env::var_os("SYSTEMLESS_QD3D_TRIMESH_TRACE").is_some())
}
pub(crate) fn qd3d_collision_trace_enabled() -> bool {
*QD3D_COLLISION_TRACE_ENABLED
.get_or_init(|| std::env::var_os("SYSTEMLESS_QD3D_COLLISION_TRACE").is_some())
}
pub(crate) fn qd3d_dump_frame_enabled() -> bool {
*QD3D_DUMP_FRAME_ENABLED
.get_or_init(|| std::env::var_os("SYSTEMLESS_QD3D_DUMP_FRAME").is_some())
}
pub(super) fn qt_trace_enabled() -> bool {
*QT_TRACE_ENABLED.get_or_init(|| std::env::var_os("SYSTEMLESS_QT_TRACE").is_some())
}
pub(super) fn ppc_sound_trace_enabled() -> bool {
*PPC_SOUND_TRACE_ENABLED.get_or_init(|| std::env::var_os("SYSTEMLESS_TRACE_SOUND").is_some())
}
fn ppc_timer_trace_enabled() -> bool {
*PPC_TIMER_TRACE_ENABLED.get_or_init(|| std::env::var_os("SYSTEMLESS_TRACE_TIMER").is_some())
}
fn ppc_pt_in_rect_trace_enabled() -> bool {
*PPC_PT_IN_RECT_TRACE_ENABLED
.get_or_init(|| std::env::var_os("SYSTEMLESS_PPC_TRACE_PT_IN_RECT").is_some())
}
pub(super) fn format_ppc_fourcc(value: u32) -> String {
value
.to_be_bytes()
.into_iter()
.map(|byte| {
if byte.is_ascii_graphic() || byte == b' ' {
char::from(byte)
} else {
'.'
}
})
.collect()
}
fn format_ppc_trace_fetch(pc: u32, word: u32) -> String {
format!("[PPC-TRACE] fetch pc=${:08X} word=${:08X}", pc, word)
}
fn format_ppc_trace_import(entry: &PpcHleImportTraceEntry) -> String {
format!(
"[PPC-TRACE] import #{} {}:{} pc=${:08X} lr=${:08X} rtoc=${:08X} sp=${:08X} target={:?}",
entry.import_index,
entry.library_name,
entry.symbol_name,
entry.pc,
entry.lr,
entry.rtoc,
entry.sp,
entry.dispatcher_target
)
}
fn format_ppc_trace_unknown_import(index: u32, pc: u32, lr: u32, rtoc: u32, sp: u32) -> String {
format!(
"[PPC-TRACE] import #{} <unknown> pc=${:08X} lr=${:08X} rtoc=${:08X} sp=${:08X}",
index, pc, lr, rtoc, sp
)
}
fn is_sprocket_import(binding: &PpcImportBinding) -> bool {
matches!(
binding.library_name.as_str(),
"DrawSprocketLib" | "InputSprocketLib"
)
}
fn format_hex_opt(value: Option<u32>) -> String {
value
.map(|value| format!("${:08X}", value))
.unwrap_or_else(|| "none".to_string())
}
pub(crate) fn format_hle_import_action(action: &PpcImportAction) -> String {
format_ppc_import_action(action)
}
fn ppc_import_action_with_extra_cycles(
action: PpcImportAction,
extra_cycles: u64,
) -> PpcImportAction {
if extra_cycles == 0 {
return action;
}
match action {
PpcImportAction::Return(value) => {
PpcImportAction::ReturnWithExtraCycles(value, extra_cycles)
}
PpcImportAction::ReturnPreserve => {
PpcImportAction::ReturnPreserveWithExtraCycles(extra_cycles)
}
PpcImportAction::ReturnPreserveWithExtraCycles(existing) => {
PpcImportAction::ReturnPreserveWithExtraCycles(existing.saturating_add(extra_cycles))
}
PpcImportAction::ReturnWithExtraCycles(value, existing) => {
PpcImportAction::ReturnWithExtraCycles(value, existing.saturating_add(extra_cycles))
}
_ => action,
}
}
fn ppc_import_extra_cycles_for_target(target: &PpcImportDispatcherTarget) -> u64 {
match target {
PpcImportDispatcherTarget::Q3ViewEndRendering => 0,
PpcImportDispatcherTarget::MathCeil
| PpcImportDispatcherTarget::MathSqrt
| PpcImportDispatcherTarget::MathExp
| PpcImportDispatcherTarget::MathSin
| PpcImportDispatcherTarget::MathCos
| PpcImportDispatcherTarget::MathAsin
| PpcImportDispatcherTarget::MathTan
| PpcImportDispatcherTarget::MathAtan
| PpcImportDispatcherTarget::MathAtan2
| PpcImportDispatcherTarget::MathPow
| PpcImportDispatcherTarget::MathFmod
| PpcImportDispatcherTarget::MathLog
| PpcImportDispatcherTarget::MathLog10 => PPC_MATH_HOT_IMPORT_EXTRA_CYCLES,
PpcImportDispatcherTarget::DrawChar
| PpcImportDispatcherTarget::DrawText
| PpcImportDispatcherTarget::DrawString => PPC_DRAW_TEXT_IMPORT_EXTRA_CYCLES,
PpcImportDispatcherTarget::MeasureText
| PpcImportDispatcherTarget::TextWidth
| PpcImportDispatcherTarget::TruncString
| PpcImportDispatcherTarget::StringWidth
| PpcImportDispatcherTarget::CharWidth
| PpcImportDispatcherTarget::GetFontInfo
| PpcImportDispatcherTarget::FontMetrics => PPC_MEASURE_TEXT_IMPORT_EXTRA_CYCLES,
PpcImportDispatcherTarget::DrawPicture => PPC_DRAW_PICTURE_IMPORT_EXTRA_CYCLES,
PpcImportDispatcherTarget::CopyBits => PPC_BIT_TRANSFER_IMPORT_EXTRA_CYCLES,
PpcImportDispatcherTarget::PaintArc
| PpcImportDispatcherTarget::PaintRect
| PpcImportDispatcherTarget::PaintRoundRect
| PpcImportDispatcherTarget::FillCRect
| PpcImportDispatcherTarget::FillRgn
| PpcImportDispatcherTarget::EraseOval
| PpcImportDispatcherTarget::EraseRect
| PpcImportDispatcherTarget::InvertRect
| PpcImportDispatcherTarget::InvertRgn
| PpcImportDispatcherTarget::FrameRect
| PpcImportDispatcherTarget::FrameRgn => PPC_DRAW_PRIMITIVE_IMPORT_EXTRA_CYCLES,
PpcImportDispatcherTarget::GetIndString
| PpcImportDispatcherTarget::GetString
| PpcImportDispatcherTarget::GetResource
| PpcImportDispatcherTarget::Get1Resource
| PpcImportDispatcherTarget::Get1NamedResource
| PpcImportDispatcherTarget::Get1IndResource
| PpcImportDispatcherTarget::LoadResource
| PpcImportDispatcherTarget::ReadPartialResource => PPC_RESOURCE_IMPORT_EXTRA_CYCLES,
_ => 0,
}
}
fn ppc_import_extra_cycles_for_binding(binding: &PpcImportBinding) -> u64 {
if is_quickdraw_3d_library(&binding.library_name)
|| is_quickdraw_3d_accelerator_library(&binding.library_name)
{
return PPC_Q3_HOT_IMPORT_EXTRA_CYCLES;
}
ppc_import_extra_cycles_for_target(&binding.dispatcher_target)
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
struct Qd3dTraceSnapshot {
objects: usize,
views: usize,
submissions: usize,
completed_frames: usize,
memory_storages: usize,
files: usize,
group_memberships: usize,
trimeshes: usize,
draw_contexts: usize,
textures: usize,
shaders: usize,
styles: usize,
cameras: usize,
lights: usize,
latest_object: Option<PpcQ3ObjectRecord>,
latest_submission: Option<PpcQ3SubmissionRecord>,
latest_frame_view: Option<u32>,
latest_frame_submissions: usize,
}
fn qd3d_trace_snapshot(
q3_objects: &[PpcQ3ObjectRecord],
q3_views: &[PpcQ3ViewStateRecord],
q3_submissions: &[PpcQ3SubmissionRecord],
q3_completed_frames: &[PpcQ3CompletedFrameRecord],
q3_state_only_completed_frame_batches: &[PpcQ3StateOnlyCompletedFrameBatch],
q3_memory_storages: &[PpcQ3MemoryStorageRecord],
q3_files: &[PpcQ3FileRecord],
q3_group_memberships: &[PpcQ3GroupMembershipRecord],
q3_trimeshes: &[PpcQ3TriMeshRecord],
q3_draw_contexts: &[PpcQ3DrawContextRecord],
q3_mipmap_textures: &[PpcQ3MipmapTextureRecord],
q3_texture_shaders: &[PpcQ3TextureShaderRecord],
q3_styles: &[PpcQ3StyleRecord],
q3_cameras: &[PpcQ3CameraRecord],
q3_lights: &[PpcQ3LightRecord],
) -> Qd3dTraceSnapshot {
let (latest_frame_view, latest_frame_submissions) = q3_completed_frames
.last()
.map(|frame| (Some(frame.view), frame.submissions.len()))
.unwrap_or((None, 0));
Qd3dTraceSnapshot {
objects: q3_objects.len(),
views: q3_views.len(),
submissions: q3_submissions.len(),
completed_frames: q3_completed_frames.len().saturating_add(
q3_state_only_completed_frame_total(q3_state_only_completed_frame_batches),
),
memory_storages: q3_memory_storages.len(),
files: q3_files.len(),
group_memberships: q3_group_memberships.len(),
trimeshes: q3_trimeshes.len(),
draw_contexts: q3_draw_contexts.len(),
textures: q3_mipmap_textures.len(),
shaders: q3_texture_shaders.len(),
styles: q3_styles.len(),
cameras: q3_cameras.len(),
lights: q3_lights.len(),
latest_object: q3_objects.last().copied(),
latest_submission: q3_submissions.last().copied(),
latest_frame_view,
latest_frame_submissions,
}
}
fn qd3d_trace_count(label: &str, before: usize, after: usize) -> String {
let delta = after as isize - before as isize;
format!("{}={}({:+})", label, after, delta)
}
fn q3_object_kind_name(kind: PpcQ3ObjectKind) -> &'static str {
match kind {
PpcQ3ObjectKind::Generic => "generic",
PpcQ3ObjectKind::MemoryStorage => "memory-storage",
}
}
fn q3_submission_kind_name(kind: PpcQ3SubmissionKind) -> &'static str {
match kind {
PpcQ3SubmissionKind::Shader => "shader",
PpcQ3SubmissionKind::Style => "style",
PpcQ3SubmissionKind::FogStyle => "fog-style",
PpcQ3SubmissionKind::TriMesh => "trimesh",
PpcQ3SubmissionKind::MatrixTransform => "matrix-transform",
PpcQ3SubmissionKind::ResetTransform => "reset-transform",
PpcQ3SubmissionKind::Push => "push",
PpcQ3SubmissionKind::Pop => "pop",
PpcQ3SubmissionKind::Object => "object",
}
}
fn format_qd3d_latest_object(snapshot: &Qd3dTraceSnapshot) -> String {
snapshot
.latest_object
.map(|object| {
format!(
"object={} kind={} type=${:08X} data=${:08X}/{}",
format_hex_opt(Some(object.object)),
q3_object_kind_name(object.kind),
object.object_type,
object.data_ptr,
object.data_size
)
})
.unwrap_or_else(|| "object=none".to_string())
}
fn format_qd3d_latest_submission(snapshot: &Qd3dTraceSnapshot) -> String {
snapshot
.latest_submission
.map(|submission| {
format!(
"submission={} view={} primary={} secondary={}",
q3_submission_kind_name(submission.kind),
format_hex_opt(Some(submission.view)),
format_hex_opt(Some(submission.primary)),
format_hex_opt(Some(submission.secondary))
)
})
.unwrap_or_else(|| "submission=none".to_string())
}
fn format_qd3d_latest_frame(snapshot: &Qd3dTraceSnapshot) -> String {
snapshot
.latest_frame_view
.map(|view| {
format!(
"frame_view={} frame_submissions={}",
format_hex_opt(Some(view)),
snapshot.latest_frame_submissions
)
})
.unwrap_or_else(|| "frame=none".to_string())
}
fn format_qd3d_trace(
entry: &PpcHleImportTraceEntry,
args: [u32; 6],
action: &str,
before: &Qd3dTraceSnapshot,
after: &Qd3dTraceSnapshot,
) -> String {
format!(
"[QD3D-TRACE] {}:{} pc=${:08X} lr=${:08X} rtoc=${:08X} sp=${:08X} r3=${:08X} r4=${:08X} r5=${:08X} r6=${:08X} r7=${:08X} r8=${:08X} action={} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}",
entry.library_name,
entry.symbol_name,
entry.pc,
entry.lr,
entry.rtoc,
entry.sp,
args[0],
args[1],
args[2],
args[3],
args[4],
args[5],
action,
qd3d_trace_count("objects", before.objects, after.objects),
qd3d_trace_count("views", before.views, after.views),
qd3d_trace_count("submissions", before.submissions, after.submissions),
qd3d_trace_count("frames", before.completed_frames, after.completed_frames),
qd3d_trace_count("storages", before.memory_storages, after.memory_storages),
qd3d_trace_count("files", before.files, after.files),
qd3d_trace_count("groups", before.group_memberships, after.group_memberships),
qd3d_trace_count("trimeshes", before.trimeshes, after.trimeshes),
qd3d_trace_count("draw_contexts", before.draw_contexts, after.draw_contexts),
qd3d_trace_count("textures", before.textures, after.textures),
qd3d_trace_count("shaders", before.shaders, after.shaders),
qd3d_trace_count("styles", before.styles, after.styles),
qd3d_trace_count("cameras", before.cameras, after.cameras),
qd3d_trace_count("lights", before.lights, after.lights),
format_qd3d_latest_object(after),
format_qd3d_latest_submission(after),
format_qd3d_latest_frame(after)
)
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
struct PpcWatchRange {
start: u32,
len: u32,
}
impl PpcWatchRange {
fn contains(self, addr: u32) -> bool {
let start = u64::from(self.start);
let end = start + u64::from(self.len);
let addr = u64::from(addr);
addr >= start && addr < end
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
struct PpcWatchWriteRecord {
pc: u32,
lr: u32,
rtoc: u32,
sp: u32,
addr: u32,
value: u8,
}
struct PpcWatchObserver {
range: PpcWatchRange,
}
impl PpcMemoryWriteObserver for PpcWatchObserver {
fn on_write(&mut self, pc: u32, lr: u32, rtoc: u32, sp: u32, addr: u32, value: u8) {
if self.range.contains(addr) {
eprintln!(
"{}",
format_ppc_watch_write(PpcWatchWriteRecord {
pc,
lr,
rtoc,
sp,
addr,
value,
})
);
}
}
}
static PPC_WATCH_RANGE: OnceLock<Option<PpcWatchRange>> = OnceLock::new();
fn ppc_watch_range() -> Option<PpcWatchRange> {
*PPC_WATCH_RANGE.get_or_init(|| {
let value = std::env::var_os("SYSTEMLESS_PPC_WATCH")?;
parse_ppc_watch_range_value(&value)
})
}
fn parse_ppc_watch_range_value(value: &std::ffi::OsStr) -> Option<PpcWatchRange> {
let value = value.to_str()?.trim();
if value.is_empty() {
return None;
}
let mut parts = value.split(':');
let start = parse_ppc_watch_addr(parts.next()?)?;
let len = match parts.next() {
Some(raw_len) => parse_ppc_watch_len(raw_len)?,
None => 1,
};
if parts.next().is_some() {
return None;
}
if len == 0 || u64::from(start) + u64::from(len) > (u64::from(u32::MAX) + 1) {
return None;
}
Some(PpcWatchRange { start, len })
}
fn parse_ppc_watch_addr(value: &str) -> Option<u32> {
let value = value
.trim()
.trim_start_matches('$')
.trim_start_matches("0x")
.trim_start_matches("0X");
if value.is_empty() {
return None;
}
u32::from_str_radix(value, 16).ok()
}
fn parse_ppc_watch_len(value: &str) -> Option<u32> {
let value = value.trim();
if value.is_empty() {
return None;
}
let len = value
.strip_prefix("0x")
.or_else(|| value.strip_prefix("0X"))
.map_or_else(
|| value.parse().ok(),
|hex| u32::from_str_radix(hex, 16).ok(),
)?;
(len != 0).then_some(len)
}
fn format_ppc_watch_write(record: PpcWatchWriteRecord) -> String {
format!(
"[PPC-WATCH] pc=${:08X} lr=${:08X} rtoc=${:08X} sp=${:08X} addr=${:08X} value=${:02X}",
record.pc, record.lr, record.rtoc, record.sp, record.addr, record.value
)
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(super) struct PpcCallbackTarget {
pub(super) entry: u32,
pub(super) rtoc: u32,
pub(super) proc_info: u32,
pub(super) routine_flags: u16,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
struct PpcAppleEventDispatchAllocation {
resume_guest_call_depth: usize,
descriptors: u32,
event_handle: u32,
reply_handle: u32,
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub(crate) struct PpcAppleEventState {
pub(crate) apple_event_launch_state: SharedProcessAppleEventLaunchState,
handlers: SharedProcessAppleEventHandlers,
descriptors: SharedProcessAppleEventDescriptors,
pending_dispatches: Vec<PpcAppleEventDispatchAllocation>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PpcToolboxStartupState {
gestalt_values: HashMap<u32, u32>,
pub init_graf_count: u32,
pub init_graf_global_ptr: u32,
pub fonts_initialized: bool,
pub windows_initialized: bool,
pub menus_initialized: bool,
pub menu_bar_draw_count: u32,
pub host_menu_bar_hidden: bool,
pub(crate) pending_native_menu_selection: SharedNativeMenuSelection,
pub(crate) execution: ExecutionMenuViews,
mixed_mode_m68k: SharedProcessMixedModeM68kState,
system_allocations: PpcSystemAllocationPool,
cf_strings: dispatch_core_foundation::PpcCfStringState,
icon_refs: dispatch_icon_services::PpcIconRefState,
go_away_tracking: Option<PpcGoAwayTrackingState>,
drag_window_tracking: Option<PpcDragWindowTrackingState>,
grow_window_tracking: Option<PpcGrowWindowTrackingState>,
standard_file_get_filtering: Option<PpcStandardFileFilteringState>,
standard_file_get_tracking: Option<PpcStandardFileGetTrackingState>,
standard_file_put_tracking: Option<PpcStandardFilePutTrackingState>,
pub text_edit_initialized: bool,
pub dialogs_initialized: bool,
pub dialog_resume_proc: u32,
pub flush_events_count: u32,
pub last_flush_event_mask: u16,
pub last_flush_stop_mask: u16,
pub dispose_dialog_count: u32,
pub last_disposed_dialog: u32,
pub(crate) last_event_record: Option<EventRecordSnapshot>,
pub(crate) event_queue_probe: EventQueueProbeSnapshot,
pub(crate) last_button_result: Option<bool>,
pub(crate) last_still_down_result: Option<bool>,
pub(crate) last_wait_mouse_up_result: Option<bool>,
pub(crate) activation_event_seen: bool,
pub(crate) update_event_seen: bool,
pub delay_deadline: Option<u32>,
pub next_ct_seed: u32,
pub(crate) last_quickdraw_error: SharedProcessQuickDrawError,
pub open_region_port: u32,
pub open_region_save_handle: u32,
pub open_region_bounds: Option<(i16, i16, i16, i16)>,
pub open_region_rows: Option<(i16, Vec<Vec<i16>>)>,
open_picture: Option<(u32, u32, (i16, i16, i16, i16), Vec<u8>)>,
application_palette: u32,
application_palette_updates: u16,
palette_allocations: Vec<PpcPaletteAllocation>,
active_device_palettes: HashMap<u32, u32>,
known_gdevices: Vec<u32>,
indexed_screen_ctables: HashMap<u32, u32>,
indexed_screen_mode: Option<(u32, bool)>,
gworld_allocations: HashMap<u32, PpcGWorldAllocationRecord>,
quickdraw_back_indices: HashMap<u32, u8>,
pub clut_protected: [bool; 256],
pub clut_reserved: [bool; 256],
clut_protected_by_device: HashMap<u32, [bool; 256]>,
clut_reserved_by_device: HashMap<u32, [bool; 256]>,
pub quickdraw_pen_pattern: [u8; 8],
pub quickdraw_back_pattern: [u8; 8],
pub ae_interaction_allowed: u8,
pub(crate) stdc_signal_state: PpcStdSignalState,
}
impl Default for PpcToolboxStartupState {
fn default() -> Self {
Self {
gestalt_values: HashMap::new(),
init_graf_count: 0,
init_graf_global_ptr: 0,
fonts_initialized: false,
windows_initialized: false,
menus_initialized: false,
menu_bar_draw_count: 0,
host_menu_bar_hidden: false,
pending_native_menu_selection: SharedNativeMenuSelection::default(),
execution: ExecutionMenuViews::detached(),
mixed_mode_m68k: SharedProcessMixedModeM68kState::default(),
system_allocations: PpcSystemAllocationPool::default(),
cf_strings: dispatch_core_foundation::PpcCfStringState::default(),
icon_refs: dispatch_icon_services::PpcIconRefState::default(),
go_away_tracking: None,
drag_window_tracking: None,
grow_window_tracking: None,
standard_file_get_filtering: None,
standard_file_get_tracking: None,
standard_file_put_tracking: None,
text_edit_initialized: false,
dialogs_initialized: false,
dialog_resume_proc: 0,
flush_events_count: 0,
last_flush_event_mask: 0,
last_flush_stop_mask: 0,
dispose_dialog_count: 0,
last_disposed_dialog: 0,
last_event_record: None,
event_queue_probe: EventQueueProbeSnapshot::default(),
last_button_result: None,
last_still_down_result: None,
last_wait_mouse_up_result: None,
activation_event_seen: false,
update_event_seen: false,
delay_deadline: None,
next_ct_seed: 0,
last_quickdraw_error: SharedProcessQuickDrawError::default(),
open_region_port: 0,
open_region_save_handle: 0,
open_region_bounds: None,
open_region_rows: None,
open_picture: None,
application_palette: 0,
application_palette_updates: 0,
palette_allocations: Vec::new(),
active_device_palettes: HashMap::new(),
known_gdevices: vec![PPC_MAIN_GDEVICE],
indexed_screen_ctables: HashMap::new(),
indexed_screen_mode: Some((PPC_MAIN_PIXEL_DEPTH, true)),
gworld_allocations: HashMap::new(),
quickdraw_back_indices: HashMap::new(),
clut_protected: [false; 256],
clut_reserved: [false; 256],
clut_protected_by_device: HashMap::new(),
clut_reserved_by_device: HashMap::new(),
quickdraw_pen_pattern: [0xff; 8],
quickdraw_back_pattern: [0x00; 8],
ae_interaction_allowed: 1,
stdc_signal_state: PpcStdSignalState::default(),
}
}
}
impl PpcToolboxStartupState {
pub(crate) fn retained_host_overlay_rects(&self) -> Vec<(i16, i16, i16, i16)> {
self.standard_file_get_tracking
.iter()
.map(|tracking| tracking.bounds)
.chain(
self.standard_file_put_tracking
.iter()
.map(|tracking| tracking.bounds),
)
.collect()
}
fn active_menu_definition(&self) -> Option<&MenuDefinitionTracking> {
self.execution
.menu()
.as_ref()
.and_then(PpcMenuTracking::active_definition)
.or(self.execution.menu().context().definition.as_ref())
}
fn with_active_menu_definition_mut<R>(
&self,
update: impl FnOnce(&mut MenuDefinitionTracking) -> R,
) -> Option<R> {
if self
.execution
.menu()
.as_ref()
.and_then(PpcMenuTracking::active_definition)
.is_some()
{
return self
.execution
.with_menu_state_mut(|tracking| tracking.active_definition_mut().map(update))
.flatten();
}
self.execution
.with_existing_menu_context_mut(|context| context.definition.as_mut().map(update))
.flatten()
}
fn clear_active_menu_definition(&mut self) {
if self
.execution
.with_menu_state_mut(|tracking| tracking.take_active_definition().is_some())
.unwrap_or(false)
{
return;
}
self.execution
.with_existing_menu_context_mut(|context| context.definition = None);
}
}
pub type PpcHandleRecord = ProcessHandleRecord;
pub type PpcPtrRecord = ProcessPtrRecord;
pub type PpcHandleStateRecord = ProcessHandleStateRecord;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) struct PpcPixMapBits {
pub(crate) base_addr: u32,
pub(crate) row_bytes: u32,
pub(crate) top: i16,
pub(crate) left: i16,
pub(crate) bottom: i16,
pub(crate) right: i16,
pub(crate) width: u32,
pub(crate) height: u32,
pub(crate) depth: u32,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) struct PpcResolvedPixMapBits {
pub(crate) bits: PpcPixMapBits,
pub(crate) guest_bounds: bool,
pub(crate) authoritative_bounds: bool,
}
#[derive(Debug, Default)]
pub(crate) struct PpcProcessMemoryManager(SharedProcessMemoryManager);
#[cfg(test)]
struct PpcTestHeapCursor {
memory_manager: SharedProcessMemoryManager,
value: u32,
}
#[cfg(test)]
struct PpcTestHandles {
memory_manager: SharedProcessMemoryManager,
value: Vec<PpcHandleRecord>,
}
#[cfg(test)]
impl std::ops::Deref for PpcTestHandles {
type Target = Vec<PpcHandleRecord>;
fn deref(&self) -> &Self::Target {
&self.value
}
}
#[cfg(test)]
impl std::ops::DerefMut for PpcTestHandles {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.value
}
}
#[cfg(test)]
impl Drop for PpcTestHandles {
fn drop(&mut self) {
let mut memory_manager = self.memory_manager.borrow_mut();
let records: Vec<_> = self
.value
.iter()
.map(|record| {
(
*record,
memory_manager
.state_for_handle(record.handle)
.unwrap_or(0x40),
)
})
.collect();
memory_manager.register_native_handle_records(records);
}
}
#[cfg(test)]
impl std::ops::Deref for PpcTestHeapCursor {
type Target = u32;
fn deref(&self) -> &Self::Target {
&self.value
}
}
#[cfg(test)]
impl std::ops::DerefMut for PpcTestHeapCursor {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.value
}
}
#[cfg(test)]
impl Drop for PpcTestHeapCursor {
fn drop(&mut self) {
self.memory_manager
.borrow_mut()
.mutate_native_allocator(|allocator| {
allocator.heap.heap_cursor = self.value;
});
}
}
impl Clone for PpcProcessMemoryManager {
fn clone(&self) -> Self {
Self(self.0.detached_clone())
}
}
impl PpcProcessMemoryManager {
pub(crate) fn with_heap(heap_cursor: u32, heap_limit: u32) -> Self {
let memory_manager = Self::default();
{
let mut process_memory_manager = memory_manager.0.borrow_mut();
let process_memory_manager = process_memory_manager.native_mut();
process_memory_manager.publish_native_allocator(
ProcessNativeHeapState {
heap_base: PPC_HEAP_BASE,
heap_cursor,
heap_limit,
last_mem_error: PPC_NO_ERR,
heap_maximized: false,
master_pointer_blocks_requested: 0,
},
&[],
&[],
&[],
);
process_memory_manager.set_application_heap_limit(heap_limit);
}
memory_manager
}
fn attach_to(&mut self, memory_manager: SharedProcessMemoryManager) {
self.0 = memory_manager;
}
fn ptr_eq(&self, memory_manager: &SharedProcessMemoryManager) -> bool {
self.0.ptr_eq(memory_manager)
}
fn heap_limit(&self, fallback: u32) -> u32 {
self.0
.borrow()
.native_heap_state()
.map_or(fallback, |heap| heap.heap_limit)
}
fn heap_cursor(&self, fallback: u32) -> u32 {
self.0
.borrow()
.native_heap_state()
.map_or(fallback, |heap| heap.heap_cursor)
}
fn last_mem_error(&self) -> i16 {
self.0
.borrow()
.native_heap_state()
.map_or(0, |heap| heap.last_mem_error)
}
fn application_heap_limit(&self, fallback: u32) -> u32 {
self.0
.borrow()
.application_heap_limit(fallback)
}
#[cfg(test)]
fn heap_cursor_mut(&self) -> PpcTestHeapCursor {
PpcTestHeapCursor {
memory_manager: self.0.clone(),
value: self.heap_cursor(PPC_HEAP_BASE),
}
}
#[cfg(test)]
fn handles_mut(&self) -> PpcTestHandles {
PpcTestHandles {
memory_manager: self.0.clone(),
value: self.0.borrow().native_handle_records().to_vec(),
}
}
fn handles(&self) -> Vec<PpcHandleRecord> {
self.0.borrow().native_handle_records().to_vec()
}
}
#[derive(Debug, Clone)]
pub struct PpcLoadedApp {
pub cpu: PpcCpu,
pub memory: crate::memory::GuestAddressSpace,
pub entry_pc: u32,
pub rtoc: u32,
pub stack_base: u32,
pub stack_size: u32,
pub stack_pointer: u32,
pub(crate) tick_state: SharedProcessTickState,
pub clock_cycles_per_tick: u32,
pub clock_cycle_phase: u32,
pub(crate) trap_default_gateways: HashMap<u16, u32>,
pub native_exception_handler: u32,
pub(crate) native_exception_stack: Vec<PpcNativeExceptionContext>,
pub(crate) stdc_qsort_stack: Vec<PpcQsortState>,
pub(crate) dialog_callback_stack: Vec<PpcDialogCallbackState>,
pub(crate) collection_callback_stack: Vec<PpcCollectionCallbackState>,
pub(crate) pending_file_completions: VecDeque<(u32, u32)>,
pub(crate) apple_events: PpcAppleEventState,
pub cfm: Option<PpcCfmState>,
pub(crate) controls: SharedProcessControlManager,
pub aliases: Vec<PpcAliasRecord>,
pub gworlds: Vec<PpcGWorldRecord>,
pub(crate) gworld_pixel_states: SharedProcessQuickDrawPixelStates,
pub q3_objects: Vec<PpcQ3ObjectRecord>,
pub q3_object_refs: Vec<PpcQ3ObjectReferenceRecord>,
pub next_q3_object: u32,
pub q3_error_state: PpcQ3ErrorState,
pub q3_lifecycle: PpcQ3LifecycleState,
pub q3_memory_storages: Vec<PpcQ3MemoryStorageRecord>,
pub q3_files: Vec<PpcQ3FileRecord>,
pub q3_group_memberships: Vec<PpcQ3GroupMembershipRecord>,
pub q3_file_groups: Vec<PpcQ3FileGroupRecord>,
pub q3_views: Vec<PpcQ3ViewStateRecord>,
pub q3_submissions: Vec<PpcQ3SubmissionRecord>,
pub q3_view_transforms: Vec<PpcQ3ViewTransformRecord>,
pub q3_submission_transforms: Vec<PpcQ3SubmissionTransformRecord>,
pub q3_view_materials: Vec<PpcQ3ViewMaterialRecord>,
pub q3_submission_materials: Vec<PpcQ3SubmissionMaterialRecord>,
pub q3_submission_lights: Vec<PpcQ3SubmissionLightRecord>,
pub q3_view_state_stack: Vec<PpcQ3ViewStateSnapshotRecord>,
pub q3_completed_frames: Vec<PpcQ3CompletedFrameRecord>,
pub q3_retained_frames: Vec<PpcQ3RetainedFrameRecord>,
pub q3_state_only_completed_frame_batches: Vec<PpcQ3StateOnlyCompletedFrameBatch>,
pub q3_fog_styles: Vec<PpcQ3FogStyleRecord>,
pub q3_attributes: Vec<PpcQ3AttributeRecord>,
pub q3_shader_uv_transforms: Vec<PpcQ3ShaderUvTransformRecord>,
pub q3_shader_boundaries: Vec<PpcQ3ShaderBoundaryRecord>,
pub q3_mipmap_textures: Vec<PpcQ3MipmapTextureRecord>,
pub q3_texture_shaders: Vec<PpcQ3TextureShaderRecord>,
pub q3_renderer_preferences: Vec<PpcQ3RendererPreferenceRecord>,
pub q3_draw_contexts: Vec<PpcQ3DrawContextRecord>,
pub q3_trimeshes: Vec<PpcQ3TriMeshRecord>,
pub q3_styles: Vec<PpcQ3StyleRecord>,
pub q3_cameras: Vec<PpcQ3CameraRecord>,
pub q3_lights: Vec<PpcQ3LightRecord>,
pub input_sprocket: PpcInputSprocketState,
pub input_sprocket_virtual_elements: Vec<PpcInputSprocketVirtualElementRecord>,
pub toolbox_startup: PpcToolboxStartupState,
pub quicktime: PpcQuickTimeState,
pub sound: PpcSoundState,
pub(crate) timer_tasks: SharedProcessTimerTasks,
pub(crate) vbl_tasks: SharedProcessVblTasks,
pub(crate) callback_scheduling: SharedProcessCallbackScheduling,
pub(crate) process_file_system: SharedProcessFileSystem,
pub(crate) current_gworld: SharedProcessGraphicsPort,
pub(crate) current_gdevice: SharedProcessGraphicsDevice,
pub(crate) quickdraw_op_colors: SharedProcessQuickDrawOpColors,
pub(crate) quickdraw_hilite_colors: SharedProcessQuickDrawHiliteColors,
pub screen_clut: SharedProcessDisplayClut,
pub color_manager_clut: SharedProcessDisplayClut,
pub(crate) display_gamma: SharedProcessDisplayGamma,
pub(crate) process_quickdraw_port_state_attached: bool,
pub quickdraw_fore_color: PpcRgbColor,
pub(crate) quickdraw_fore_indices: HashMap<u32, u8>,
pub quickdraw_back_color: PpcRgbColor,
pub quickdraw_pen_h: i16,
pub quickdraw_pen_v: i16,
pub quickdraw_text_mode: i16,
pub quickdraw_text_size: i16,
pub(crate) cursor_state: SharedProcessCursorState,
pub(crate) param_text: SharedProcessDialogText,
pub scrap: PpcScrapState,
pub(crate) list_manager: PpcListManagerState,
pub(crate) collections: SharedProcessCollectionManager,
pub halt_pc: u32,
pub import_trap_base: u32,
pub import_count: u32,
pub imports: Vec<PpcImportBinding>,
pub section_bases: Vec<Option<u32>>,
pub input: PpcInputSnapshot,
pub(crate) process_input: SharedProcessInputState,
pub(crate) event_queue: SharedProcessEventQueue,
pub(crate) window_list: crate::process_context::SharedProcessWindowList,
pub(crate) process_memory_manager: PpcProcessMemoryManager,
pub draw_sprocket: PpcDrawSprocketState,
}
impl std::ops::Deref for PpcLoadedApp {
type Target = ProcessFileSystemState;
fn deref(&self) -> &Self::Target {
&self.process_file_system
}
}
fn ppc_hle_import_trace_same_run(
left: &PpcHleImportTraceEntry,
right: &PpcHleImportTraceEntry,
) -> bool {
left.library_name == right.library_name && left.symbol_name == right.symbol_name
}
fn push_ppc_hle_import_trace_entry(
trace: &mut Vec<PpcHleImportTraceEntry>,
entry: PpcHleImportTraceEntry,
) {
if let Some(last) = trace.last_mut() {
if ppc_hle_import_trace_same_run(last, &entry) {
last.repeat_count = last.repeat_count.saturating_add(entry.repeat_count);
return;
}
}
trace.push(entry);
}
impl PpcLoadedApp {
pub(crate) fn assert_cfm_execution_owner(&self, process_cfm: Option<&PpcCfmState>) {
assert!(
process_cfm.is_some() || self.cfm.is_some(),
"installed native execution requires process CFM services"
);
assert!(
process_cfm.is_none() || self.cfm.is_none(),
"move the standalone CFM seed before using process services"
);
}
#[allow(clippy::too_many_arguments)]
pub(crate) fn run_with_process_services(
&mut self,
max_cycles: u64,
trace_imports: bool,
trace_fetches: bool,
memory_manager: &mut ProcessMemoryManager,
cfm: &mut PpcCfmState,
) -> PpcHleRunProbe {
self.run_with_hle_imports_with_trace(
max_cycles,
trace_imports,
trace_fetches,
Some(memory_manager),
Some(cfm),
)
}
pub fn run_with_hle_imports(&mut self, max_cycles: u64) -> PpcHleRunProbe {
self.run_with_hle_imports_with_trace(max_cycles, false, false, None, None)
}
pub fn run_with_hle_import_trace(&mut self, max_cycles: u64) -> PpcHleRunProbe {
self.run_with_hle_imports_with_trace(max_cycles, true, false, None, None)
}
pub fn run_with_hle_import_fetch_histogram(&mut self, max_cycles: u64) -> PpcHleRunProbe {
self.run_with_hle_imports_with_trace(max_cycles, false, true, None, None)
}
pub fn run_with_hle_import_trace_and_fetch_histogram(
&mut self,
max_cycles: u64,
) -> PpcHleRunProbe {
self.run_with_hle_imports_with_trace(max_cycles, true, true, None, None)
}
#[cfg(test)]
pub(crate) fn run_with_process_memory_manager(
&mut self,
max_cycles: u64,
trace_imports: bool,
trace_fetches: bool,
memory_manager: &mut ProcessMemoryManager,
) -> PpcHleRunProbe {
self.run_with_hle_imports_with_trace(
max_cycles,
trace_imports,
trace_fetches,
Some(memory_manager),
None,
)
}
pub(crate) fn run_with_hle_imports_with_trace(
&mut self,
max_cycles: u64,
trace_imports: bool,
trace_fetches: bool,
process_memory_manager: Option<&mut ProcessMemoryManager>,
mut process_cfm: Option<&mut PpcCfmState>,
) -> PpcHleRunProbe {
self.assert_cfm_execution_owner(process_cfm.as_deref());
let guest_calls = self.toolbox_startup.execution.calls().shared_handle();
let trap_default_gateways = self.trap_default_gateways.clone();
guest_calls.resume_ready_task();
if !guest_calls.current_task_is_running()
|| guest_calls.has_classic_task_handoff()
|| (guest_calls.has_pending_task_handoff()
&& !guest_calls.prepare_native_task(&mut self.cpu))
{
return PpcHleRunProbe {
result: PpcRunResult::CycleLimit { cycles: 0 },
handled_import_count: 0,
last_import_index: None,
unsupported_import_index: None,
import_trace: Vec::new(),
draw_sprocket_trace: Vec::new(),
input_sprocket_trace: Vec::new(),
fetch_histogram: None,
};
}
let standalone_memory_manager = process_memory_manager
.is_none()
.then(|| self.process_memory_manager.0.clone());
let mut standalone_memory_manager_borrow;
let process_memory_manager = if let Some(memory_manager) = process_memory_manager {
memory_manager
} else {
standalone_memory_manager_borrow = standalone_memory_manager
.as_ref()
.expect("standalone process Memory Manager created")
.borrow_mut();
assert!(
standalone_memory_manager_borrow.has_native_allocator(),
"loaded adapter owns a native allocator before execution"
);
&mut standalone_memory_manager_borrow
};
let mut import_run_state = PpcImportRunState::from_parts(
std::mem::take(&mut self.imports),
self.import_count,
ppc_import_layout(),
);
let q3_start_rendering_import_index = import_run_state
.bindings()
.iter()
.find(|binding| {
binding.dispatcher_target == PpcImportDispatcherTarget::Q3ViewStartRendering
})
.map(|binding| binding.symbol_index);
let q3_end_rendering_import_index = import_run_state
.bindings()
.iter()
.find(|binding| {
binding.dispatcher_target == PpcImportDispatcherTarget::Q3ViewEndRendering
})
.map(|binding| binding.symbol_index);
let input = self.current_input_snapshot();
self.mirror_input_low_memory(input);
let event_queue = std::mem::take(&mut self.event_queue);
let process_memory_manager = process_memory_manager.native_mut();
let _ = self.current_tick();
let tick_state = self.tick_state.shared_handle();
let clock_cycles_per_tick = self.clock_cycles_per_tick;
let clock_cycle_phase = self.clock_cycle_phase;
let mut process_file_system = self.process_file_system.shared_handle();
let current_resource_refnum = process_file_system
.current_resource_file
.shared_handle();
let mut last_resource_error = self
.memory
.read_u16_be(crate::memory::globals::addr::RES_ERR)
.unwrap_or(0) as i16;
let resource_policy = process_file_system.policy.shared_handle();
let native_exception_handler = Cell::new(self.native_exception_handler);
let mut native_exception_stack = std::mem::take(&mut self.native_exception_stack);
let mut stdc_qsort_stack = std::mem::take(&mut self.stdc_qsort_stack);
let mut dialog_callback_stack = std::mem::take(&mut self.dialog_callback_stack);
let mut collection_callback_stack = std::mem::take(&mut self.collection_callback_stack);
let mut pending_file_completions = std::mem::take(&mut self.pending_file_completions);
let mut apple_events = std::mem::take(&mut self.apple_events);
let mut standalone_cfm = if process_cfm.is_none() {
self.cfm.take()
} else {
None
};
let cfm = if let Some(cfm) = process_cfm.as_deref_mut() {
cfm
} else {
standalone_cfm.as_mut().expect("standalone CFM seed exists")
};
let (mut cfm_connections, mut cfm_library_fragments, mut next_cfm_connection_id) = (
&mut cfm.connections,
&mut cfm.library_fragments,
&mut cfm.next_connection_id,
);
let controls = std::mem::take(&mut self.controls);
let mut aliases = std::mem::take(&mut self.aliases);
let mut gworlds = std::mem::take(&mut self.gworlds);
let gworld_pixel_states = self.gworld_pixel_states.shared_handle();
let window_list = self.window_list.shared_handle();
if window_list.is_empty() {
window_list.with_mut(|windows| {
windows.extend(
gworlds
.iter()
.rev()
.map(|record| record.port)
.filter(|port| !matches!(*port, PPC_MAIN_GWORLD | PPC_DSP_BACK_GWORLD)),
);
});
}
let mut q3_objects = std::mem::take(&mut self.q3_objects);
let mut q3_object_refs = std::mem::take(&mut self.q3_object_refs);
let mut next_q3_object = self.next_q3_object;
let mut q3_error_state = self.q3_error_state;
let mut q3_lifecycle = self.q3_lifecycle;
let mut q3_memory_storages = std::mem::take(&mut self.q3_memory_storages);
let mut q3_files = std::mem::take(&mut self.q3_files);
let mut q3_group_memberships = std::mem::take(&mut self.q3_group_memberships);
let mut q3_file_groups = std::mem::take(&mut self.q3_file_groups);
let mut q3_views = std::mem::take(&mut self.q3_views);
let mut q3_submissions = std::mem::take(&mut self.q3_submissions);
let mut q3_view_transforms = std::mem::take(&mut self.q3_view_transforms);
let mut q3_submission_transforms = std::mem::take(&mut self.q3_submission_transforms);
let mut q3_view_materials = std::mem::take(&mut self.q3_view_materials);
let mut q3_submission_materials = std::mem::take(&mut self.q3_submission_materials);
let mut q3_submission_lights = std::mem::take(&mut self.q3_submission_lights);
let mut q3_view_state_stack = std::mem::take(&mut self.q3_view_state_stack);
let mut q3_completed_frames = std::mem::take(&mut self.q3_completed_frames);
let mut q3_retained_frames = std::mem::take(&mut self.q3_retained_frames);
let mut q3_state_only_completed_frame_batches =
std::mem::take(&mut self.q3_state_only_completed_frame_batches);
let mut q3_fog_styles = std::mem::take(&mut self.q3_fog_styles);
let mut q3_attributes = std::mem::take(&mut self.q3_attributes);
let mut q3_shader_uv_transforms = std::mem::take(&mut self.q3_shader_uv_transforms);
let mut q3_shader_boundaries = std::mem::take(&mut self.q3_shader_boundaries);
let mut q3_mipmap_textures = std::mem::take(&mut self.q3_mipmap_textures);
let mut q3_texture_shaders = std::mem::take(&mut self.q3_texture_shaders);
let mut q3_renderer_preferences = std::mem::take(&mut self.q3_renderer_preferences);
let mut q3_draw_contexts = std::mem::take(&mut self.q3_draw_contexts);
let mut q3_trimeshes = std::mem::take(&mut self.q3_trimeshes);
let mut q3_styles = std::mem::take(&mut self.q3_styles);
let mut q3_cameras = std::mem::take(&mut self.q3_cameras);
let mut q3_lights = std::mem::take(&mut self.q3_lights);
let mut input_sprocket = self.input_sprocket;
let mut input_sprocket_virtual_elements =
std::mem::take(&mut self.input_sprocket_virtual_elements);
let mut toolbox_startup = std::mem::take(&mut self.toolbox_startup);
let mut quicktime = std::mem::take(&mut self.quicktime);
let mut sound = std::mem::take(&mut self.sound);
let timer_tasks = std::mem::take(&mut self.timer_tasks);
let vbl_tasks = std::mem::take(&mut self.vbl_tasks);
let callback_scheduling = self.callback_scheduling.shared_handle();
let current_gworld = self.current_gworld.shared_handle();
let current_gdevice = self.current_gdevice.shared_handle();
let quickdraw_op_colors = self.quickdraw_op_colors.shared_handle();
let quickdraw_hilite_colors = self.quickdraw_hilite_colors.shared_handle();
let screen_clut = self.screen_clut.shared_handle();
let color_manager_clut = self.color_manager_clut.shared_handle();
let display_gamma = self.display_gamma.shared_handle();
let mut quickdraw_fore_color = self.quickdraw_fore_color;
let mut quickdraw_fore_indices = std::mem::take(&mut self.quickdraw_fore_indices);
let mut quickdraw_back_color = self.quickdraw_back_color;
let mut quickdraw_pen_h = self.quickdraw_pen_h;
let mut quickdraw_pen_v = self.quickdraw_pen_v;
let mut quickdraw_text_mode = self.quickdraw_text_mode;
let mut quickdraw_text_size = self.quickdraw_text_size;
let process_quickdraw_port_state_attached = self.process_quickdraw_port_state_attached;
let cursor_state = std::mem::take(&mut self.cursor_state);
let vfs_volumes = self.vfs_volumes.shared_handle();
let vfs_directories = self.vfs_directories.shared_handle();
let next_vfs_dir_id = self.next_vfs_dir_id.shared_handle();
let default_dir_id = self.default_dir_id.shared_handle();
let working_directories = self.working_directories.shared_handle();
let next_working_directory_ref_num = self
.next_working_directory_ref_num
.shared_handle();
let application_working_directory_ref_num = self
.application_working_directory_ref_num
.shared_handle();
let param_text = self.param_text.shared_handle();
let mut scrap = std::mem::take(&mut self.scrap);
let list_manager = std::mem::take(&mut self.list_manager);
let collections = self.collections.shared_handle();
let mut draw_sprocket = std::mem::take(&mut self.draw_sprocket);
let mut handled_import_count = 0u32;
let mut last_import_index = None;
let mut unsupported_import_index = None;
let mut import_trace = Vec::new();
let mut draw_sprocket_trace = Vec::new();
let mut input_sprocket_trace = Vec::new();
let mut fetch_histogram = PpcFetchHistogram::new();
let trace_ppc = ppc_trace_enabled();
let trace_sprocket = sprocket_trace_enabled();
let trace_qd3d = qd3d_trace_enabled();
let trace_pc_range = ppc_trace_pc_range();
let trace_recent_on_halt = ppc_recent_imports_on_halt_enabled();
let mut recent_imports = VecDeque::<PpcHleImportTraceEntry>::new();
let mut idle_poll_counts = HashMap::<u32, u32>::new();
let mut tick_count_idle_poll = PpcTickCountIdlePollState::default();
let needs_fetch_observer = trace_fetches || trace_ppc || trace_pc_range.is_some();
let mut fetch_observer = PpcHleFetchObserver {
histogram: if trace_fetches {
Some(&mut fetch_histogram)
} else {
None
},
trace_fetches: trace_ppc,
trace_pc_range,
};
let result = {
type Mem = PpcSectionMem;
let mut handle_import = |elapsed, index, cpu: &mut PpcCpu, memory: &mut Mem| {
if index == PPC_THREAD_RETURN_IMPORT_INDEX {
let task = guest_calls.current_task();
let result = cpu.gpr[3];
if let Some((procedure, parameter)) = guest_calls.take_thread_terminator(task) {
if procedure != 0 {
if install_powerpc_call_arguments(
cpu,
memory,
&[task.thread_id(), parameter],
)
.is_none()
{
return PpcImportAction::Halt;
}
return GuestCallEffect::call_guest(
GuestCallRequest::new(GuestCallTarget {
isa: GuestIsa::PowerPc,
entry: procedure,
rtoc: cpu.gpr[2],
}),
GuestCallContinuation::to_powerpc(
PPC_GUEST_CALL_RETURN_PC,
PPC_THREAD_RETURN_PC,
cpu.gpr[2],
PpcNativeReturnGpr3::Set(result),
),
)
.into_ppc_import_action()
.unwrap_or(PpcImportAction::Halt);
}
}
if let Ok(retirement) =
guest_calls.retire_native_thread(task, cpu, false, |context| {
context.result_destination == 0
|| memory
.write_u32_be(context.result_destination, result)
.is_some()
})
{
ppc_release_retired_thread_storage(
process_memory_manager,
retirement,
false,
);
}
return PpcImportAction::Yield(1);
}
if index == PPC_GUEST_CALL_RETURN_IMPORT_INDEX {
let mut resource_call = None;
if toolbox_startup.execution.menu().ready_call(GuestIsa::PowerPc).is_some()
|| guest_calls
.ready_menu_bar_build(GuestIsa::PowerPc)
.is_some()
|| guest_calls.complete_powerpc_resuming_operation(
cpu,
process_memory_manager,
|operation, result| match operation {
crate::guest_call::ManagerContinuation::Menu(
crate::guest_call::MenuManagerContinuation::Definition(operation),
) => {
operation.complete(memory);
result
}
crate::guest_call::ManagerContinuation::Menu(
crate::guest_call::MenuManagerContinuation::Hook(_),
) => unreachable!("MenuHook completes after native caller restore"),
crate::guest_call::ManagerContinuation::Cfm(CfmOperation::Load(
load,
)) => ppc_complete_cfm_load(load, result, memory, &mut cfm_connections),
crate::guest_call::ManagerContinuation::Cfm(
CfmOperation::Resource(call),
) => match call.complete(result, &mut cfm_connections, memory) {
Ok(call) => {
resource_call = Some(call);
0
}
Err(error) => ppc_i16_result(error.os_error()),
},
},
) {
if guest_calls.ready_menu_bar_build(GuestIsa::PowerPc).is_some() {
let heap = process_memory_manager.native_heap_state()
.expect("native allocator registered during execution");
let mut cursor = heap.heap_cursor;
let limit =
process_memory_manager.native_allocation_limit(heap.heap_limit);
return ppc_continue_menu_bar_build(
cpu,
process_memory_manager,
memory,
&mut cursor,
limit,
&mut toolbox_startup,
&process_file_system.resource_manager.vfs_resources,
*current_resource_refnum,
);
}
if let Some((_call, _scope)) = toolbox_startup.execution.resume_menu_call(GuestIsa::PowerPc) {
let heap = process_memory_manager.native_heap_state()
.expect("native allocator registered during execution");
let mut cursor = heap.heap_cursor;
let limit = process_memory_manager.native_allocation_limit(heap.heap_limit);
return current_gworld.with_mut(|current_gworld| {
current_gdevice.with_mut(|current_gdevice| {
ppc_step_menu_tracking(
cpu,
process_memory_manager,
memory,
&mut cursor,
limit,
&gworlds,
&screen_clut,
&mut toolbox_startup,
current_gworld,
current_gdevice,
input,
&process_file_system.resource_manager.vfs_resources,
*current_resource_refnum,
)
.unwrap_or(PpcImportAction::Halt)
})
});
}
if let Some(call) = resource_call {
if let Err(error) = ppc_invoke_prepared_resource(
cpu,
memory,
&guest_calls,
call,
cpu.pc,
) {
cpu.gpr[3] = ppc_i16_result(error);
}
return PpcImportAction::Continue;
}
let native_heap = process_memory_manager
.native_heap_state()
.expect("native allocator registered during execution");
let mut heap_cursor = native_heap.heap_cursor;
let mut last_mem_error = native_heap.last_mem_error;
let handles =
&mut process_memory_manager.native_handle_records().to_vec();
ppc_complete_apple_event_dispatch(
&mut apple_events,
guest_calls.depth(),
&mut *process_memory_manager,
memory,
&mut heap_cursor,
&mut last_mem_error,
handles,
);
process_memory_manager.set_native_mem_error(last_mem_error);
return PpcImportAction::Continue;
}
if guest_calls.complete_powerpc_for_m68k(cpu) {
return PpcImportAction::Halt;
}
unsupported_import_index = Some(index);
return PpcImportAction::Halt;
}
last_import_index = Some(index);
let process_tick = memory
.read_u32_be(crate::memory::globals::addr::TICKS)
.map(|guest_ticks| tick_state.read_tick_count(guest_ticks))
.unwrap_or_else(|| tick_state.current_tick());
let mut import_tick_count = ppc_virtual_tick_count(
process_tick,
clock_cycles_per_tick,
clock_cycle_phase,
elapsed,
);
let dispatcher_target = import_run_state.dispatcher_target_cloned(index);
let is_tick_count_import = dispatcher_target.as_ref().is_some_and(|target| {
*target == PpcImportDispatcherTarget::TickCount
});
let mut binding = trace_recent_on_halt
.then(|| import_run_state.binding_cloned(index))
.flatten();
if !is_tick_count_import {
tick_count_idle_poll.reset();
}
if !trace_imports && !trace_ppc && !trace_qd3d {
if q3_start_rendering_import_index == Some(index) {
let action =
PpcImportAction::Return(u32::from(ppc_q3_view_start_rendering(
cpu,
&mut q3_views,
&q3_objects,
&mut q3_submissions,
&mut q3_submission_transforms,
&mut q3_submission_materials,
&mut q3_submission_lights,
&mut q3_error_state,
)));
handled_import_count = handled_import_count.saturating_add(1);
return ppc_import_action_with_extra_cycles(
action,
PPC_Q3_HOT_IMPORT_EXTRA_CYCLES,
);
}
if q3_end_rendering_import_index == Some(index) {
let action = dispatch_q3_view_end_rendering_import(
cpu,
&mut q3_views,
&q3_objects,
&mut q3_submissions,
&mut q3_submission_transforms,
&mut q3_submission_materials,
&mut q3_submission_lights,
&mut q3_completed_frames,
&mut q3_retained_frames,
&mut q3_state_only_completed_frame_batches,
&q3_draw_contexts,
&q3_trimeshes,
&gworlds,
*current_gworld,
&mut q3_error_state,
input.is_idle(),
);
handled_import_count = handled_import_count.saturating_add(1);
return ppc_import_action_with_extra_cycles(
action,
PPC_Q3_HOT_IMPORT_EXTRA_CYCLES,
);
}
}
let Some(dispatcher_target) = dispatcher_target.as_ref() else {
unsupported_import_index = Some(index);
if trace_ppc {
eprintln!(
"{}",
format_ppc_trace_unknown_import(
index, cpu.pc, cpu.lr, cpu.gpr[2], cpu.gpr[1]
)
);
}
return PpcImportAction::Halt;
};
match ppc_live_trap_import_action(
dispatcher_target,
&trap_default_gateways,
cpu,
&mut *process_memory_manager,
memory,
&mut toolbox_startup,
) {
Ok(Some(action)) => {
if trace_imports {
if binding.is_none() {
binding = import_run_state.binding_cloned(index);
}
let binding = binding
.as_ref()
.expect("live trap import tracing resolves a known binding");
push_ppc_hle_import_trace_entry(
&mut import_trace,
PpcHleImportTraceEntry {
import_index: index,
library_name: binding.library_name.clone(),
symbol_name: binding.symbol_name.clone(),
pc: cpu.pc,
lr: cpu.lr,
rtoc: cpu.gpr[2],
sp: cpu.gpr[1],
dispatcher_target: dispatcher_target.clone(),
repeat_count: 1,
},
);
}
handled_import_count = handled_import_count.saturating_add(1);
return guest_calls.externalize_powerpc_action(cpu, action);
}
Ok(None) => {}
Err(()) => return PpcImportAction::Halt,
}
if trace_recent_on_halt {
let binding = binding
.as_ref()
.expect("recent import tracing resolves a known binding");
let entry = PpcHleImportTraceEntry {
import_index: index,
library_name: binding.library_name.clone(),
symbol_name: binding.symbol_name.clone(),
pc: cpu.pc,
lr: cpu.lr,
rtoc: cpu.gpr[2],
sp: cpu.gpr[1],
dispatcher_target: binding.dispatcher_target.clone(),
repeat_count: 1,
};
match recent_imports.back_mut() {
Some(last) if ppc_hle_import_trace_same_run(last, &entry) => {
last.repeat_count = last.repeat_count.saturating_add(1);
}
_ => recent_imports.push_back(entry),
}
while recent_imports.len() > 64 {
recent_imports.pop_front();
}
}
let null_dialog_poll = matches!(
dispatcher_target,
PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::DialogSelect
)
) && dialog_callback_stack.is_empty()
&& memory.read_u16_be(cpu.gpr[3]) == Some(0);
if !trace_ppc
&& (*dispatcher_target != PpcImportDispatcherTarget::TickCount
|| !trace_imports)
&& (matches!(
dispatcher_target,
PpcImportDispatcherTarget::Button
| PpcImportDispatcherTarget::StillDown
| PpcImportDispatcherTarget::WaitMouseUp
| PpcImportDispatcherTarget::GetKeys
| PpcImportDispatcherTarget::TickCount
| PpcImportDispatcherTarget::Microseconds
| PpcImportDispatcherTarget::GetCurrentThread
| PpcImportDispatcherTarget::YieldToThread
| PpcImportDispatcherTarget::GetMenuHandle
| PpcImportDispatcherTarget::StdFilterProc
| PpcImportDispatcherTarget::EnableMenuItem
| PpcImportDispatcherTarget::DisableMenuItem
) || null_dialog_poll)
{
if trace_imports {
if binding.is_none() {
binding = import_run_state.binding_cloned(index);
}
let binding = binding
.as_ref()
.expect("import tracing resolves a known binding");
push_ppc_hle_import_trace_entry(
&mut import_trace,
PpcHleImportTraceEntry {
import_index: index,
library_name: binding.library_name.clone(),
symbol_name: binding.symbol_name.clone(),
pc: cpu.pc,
lr: cpu.lr,
rtoc: cpu.gpr[2],
sp: cpu.gpr[1],
dispatcher_target: dispatcher_target.clone(),
repeat_count: 1,
},
);
}
let action = match dispatcher_target {
PpcImportDispatcherTarget::Button => {
toolbox_startup.last_button_result = Some(input.mouse_button);
dispatch_button_import(cpu, input, Some(&mut idle_poll_counts))
}
PpcImportDispatcherTarget::StillDown => {
let (still_down, action) = event_queue.with_ref(|queue| {
let still_down = ppc_still_down_result(input, queue);
let action = dispatch_still_down_import(
cpu,
input,
queue,
Some(&mut idle_poll_counts),
);
(still_down, action)
});
toolbox_startup.last_still_down_result = Some(still_down);
action
}
PpcImportDispatcherTarget::WaitMouseUp => {
let result = event_queue
.with_mut(|queue| ppc_wait_mouse_up_result(input, queue));
toolbox_startup.last_wait_mouse_up_result = Some(result);
PpcImportAction::Return(u32::from(result))
}
PpcImportDispatcherTarget::GetKeys => {
dispatch_getkeys_import(cpu, memory, input, Some(&mut idle_poll_counts))
}
PpcImportDispatcherTarget::TickCount => dispatch_tick_count_import(
cpu,
import_tick_count,
ppc_cycles_until_next_tick(
clock_cycles_per_tick,
clock_cycle_phase,
elapsed,
)
.min(max_cycles.saturating_sub(elapsed)),
Some(&mut tick_count_idle_poll),
),
PpcImportDispatcherTarget::Microseconds => dispatch_microseconds_import(
cpu,
memory,
ppc_virtual_microseconds(
process_tick,
clock_cycles_per_tick,
clock_cycle_phase,
elapsed,
),
Some(&mut idle_poll_counts),
),
PpcImportDispatcherTarget::GetCurrentThread => {
let id = ThreadManager::new(toolbox_startup.execution.calls())
.current_thread();
let result = if cpu.gpr[3] != 0
&& memory.write_u32_be(cpu.gpr[3], id).is_some()
{
PPC_NO_ERR
} else {
PPC_PARAM_ERR
};
PpcImportAction::Return(ppc_i16_result(result))
}
PpcImportDispatcherTarget::YieldToThread => {
let suggested = cpu.gpr[3];
let action = match toolbox_startup
.execution
.calls()
.yield_native_thread(cpu, suggested)
{
Ok(true) => PpcImportAction::Yield(1),
Ok(false) => PpcImportAction::Return(0),
Err(error) => PpcImportAction::Return(ppc_i16_result(error)),
};
if std::env::var_os("SYSTEMLESS_PPC_THREAD_TRACE").is_some() {
eprintln!("[PPC-THREAD-TRACE] YieldToThread caller={} suggested={} action={:?} pc=${:08X}", toolbox_startup.execution.calls().current_task().thread_id(), suggested, action, cpu.pc);
}
action
}
PpcImportDispatcherTarget::GetMenuHandle => {
let menu_list = ppc_current_menu_list(memory);
PpcImportAction::Return(ppc_get_menu_handle(
memory,
menu_list,
cpu.gpr[3] as u16 as i16,
))
}
PpcImportDispatcherTarget::StdFilterProc => PpcImportAction::Return(0),
PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::DialogSelect,
) => PpcImportAction::Return(0),
PpcImportDispatcherTarget::EnableMenuItem
| PpcImportDispatcherTarget::DisableMenuItem => {
ppc_set_menu_item_enabled(
memory,
process_memory_manager.native_handle_records(),
cpu.gpr[3],
cpu.gpr[4] as u16 as i16,
*dispatcher_target == PpcImportDispatcherTarget::EnableMenuItem,
);
PpcImportAction::ReturnPreserve
}
_ => unreachable!(),
};
handled_import_count = handled_import_count.saturating_add(1);
return action;
}
let Some(binding) = binding.or_else(|| import_run_state.binding_cloned(index)) else {
unsupported_import_index = Some(index);
if trace_ppc {
eprintln!(
"{}",
format_ppc_trace_unknown_import(
index, cpu.pc, cpu.lr, cpu.gpr[2], cpu.gpr[1]
)
);
}
return PpcImportAction::Halt;
};
let binding = &binding;
if !trace_ppc && !trace_qd3d {
if q3_start_rendering_import_index == Some(index) {
if trace_imports {
push_ppc_hle_import_trace_entry(
&mut import_trace,
PpcHleImportTraceEntry {
import_index: index,
library_name: binding.library_name.clone(),
symbol_name: binding.symbol_name.clone(),
pc: cpu.pc,
lr: cpu.lr,
rtoc: cpu.gpr[2],
sp: cpu.gpr[1],
dispatcher_target: binding.dispatcher_target.clone(),
repeat_count: 1,
},
);
}
let action =
PpcImportAction::Return(u32::from(ppc_q3_view_start_rendering(
cpu,
&mut q3_views,
&q3_objects,
&mut q3_submissions,
&mut q3_submission_transforms,
&mut q3_submission_materials,
&mut q3_submission_lights,
&mut q3_error_state,
)));
handled_import_count = handled_import_count.saturating_add(1);
return ppc_import_action_with_extra_cycles(
action,
ppc_import_extra_cycles_for_binding(binding),
);
}
if q3_end_rendering_import_index == Some(index) {
if trace_imports {
push_ppc_hle_import_trace_entry(
&mut import_trace,
PpcHleImportTraceEntry {
import_index: index,
library_name: binding.library_name.clone(),
symbol_name: binding.symbol_name.clone(),
pc: cpu.pc,
lr: cpu.lr,
rtoc: cpu.gpr[2],
sp: cpu.gpr[1],
dispatcher_target: binding.dispatcher_target.clone(),
repeat_count: 1,
},
);
}
let action = dispatch_q3_view_end_rendering_import(
cpu,
&mut q3_views,
&q3_objects,
&mut q3_submissions,
&mut q3_submission_transforms,
&mut q3_submission_materials,
&mut q3_submission_lights,
&mut q3_completed_frames,
&mut q3_retained_frames,
&mut q3_state_only_completed_frame_batches,
&q3_draw_contexts,
&q3_trimeshes,
&gworlds,
*current_gworld,
&mut q3_error_state,
input.is_idle(),
);
handled_import_count = handled_import_count.saturating_add(1);
return ppc_import_action_with_extra_cycles(
action,
ppc_import_extra_cycles_for_binding(binding),
);
}
}
let trace_this_sprocket = trace_sprocket && is_sprocket_import(binding);
let trace_this_qd3d = trace_qd3d
&& (is_quickdraw_3d_library(&binding.library_name)
|| is_quickdraw_3d_accelerator_library(&binding.library_name));
let entry = if trace_imports || trace_ppc || trace_this_sprocket || trace_this_qd3d
{
let entry = PpcHleImportTraceEntry {
import_index: index,
library_name: binding.library_name.clone(),
symbol_name: binding.symbol_name.clone(),
pc: cpu.pc,
lr: cpu.lr,
rtoc: cpu.gpr[2],
sp: cpu.gpr[1],
dispatcher_target: binding.dispatcher_target.clone(),
repeat_count: 1,
};
if trace_ppc {
eprintln!("{}", format_ppc_trace_import(&entry));
}
if trace_imports {
push_ppc_hle_import_trace_entry(&mut import_trace, entry.clone());
}
Some(entry)
} else {
None
};
let import_args = [
cpu.gpr[3], cpu.gpr[4], cpu.gpr[5], cpu.gpr[6], cpu.gpr[7], cpu.gpr[8],
];
let qd3d_before = if trace_this_qd3d {
Some(qd3d_trace_snapshot(
&q3_objects,
&q3_views,
&q3_submissions,
&q3_completed_frames,
&q3_state_only_completed_frame_batches,
&q3_memory_storages,
&q3_files,
&q3_group_memberships,
&q3_trimeshes,
&q3_draw_contexts,
&q3_mipmap_textures,
&q3_texture_shaders,
&q3_styles,
&q3_cameras,
&q3_lights,
))
} else {
None
};
last_resource_error = memory
.read_u16_be(crate::memory::globals::addr::RES_ERR)
.unwrap_or(last_resource_error as u16) as i16;
let native_heap = process_memory_manager
.native_heap_state()
.expect("native allocator registered during execution");
let mut heap_cursor = native_heap.heap_cursor;
let native_heap_ceiling = native_heap.heap_limit;
let heap_limit = process_memory_manager
.native_allocation_limit(native_heap_ceiling);
let mut last_mem_error = native_heap.last_mem_error;
if process_quickdraw_port_state_attached {
ppc_restore_process_port_draw_state(
memory,
*current_gworld,
&mut quickdraw_fore_color,
&mut quickdraw_back_color,
&mut quickdraw_pen_h,
&mut quickdraw_pen_v,
&mut quickdraw_text_mode,
&mut quickdraw_text_size,
);
}
let action = if binding.dispatcher_target == PpcImportDispatcherTarget::GetKeys {
Some(dispatch_getkeys_import(
cpu,
memory,
input,
Some(&mut idle_poll_counts),
))
} else if let Some(action) = dispatch_qd3d::dispatch_q3_math_import_fast(
dispatch_qd3d::PpcQ3MathDispatchContext {
target: &binding.dispatcher_target,
cpu,
memory,
q3_objects: &mut q3_objects,
next_q3_object: &mut next_q3_object,
q3_error_state: &mut q3_error_state,
},
) {
Some(action)
} else if let Some(action) = dispatch_qd3d::dispatch_q3_shader_style_import_fast(
dispatch_qd3d::PpcQ3ShaderStyleDispatchContext {
target: &binding.dispatcher_target,
cpu,
memory,
q3_objects: &mut q3_objects,
q3_object_refs: &mut q3_object_refs,
q3_error_state: &mut q3_error_state,
next_q3_object: &mut next_q3_object,
q3_texture_shaders: &mut q3_texture_shaders,
q3_mipmap_textures: &mut q3_mipmap_textures,
q3_shader_uv_transforms: &mut q3_shader_uv_transforms,
q3_shader_boundaries: &mut q3_shader_boundaries,
q3_styles: &mut q3_styles,
},
) {
Some(action)
} else if let Some(action) = dispatch_qd3d::dispatch_q3_scene_import_fast(
dispatch_qd3d::PpcQ3SceneDispatchContext {
target: &binding.dispatcher_target,
cpu,
memory,
q3_objects: &mut q3_objects,
next_q3_object: &mut next_q3_object,
q3_cameras: &mut q3_cameras,
q3_lights: &mut q3_lights,
q3_error_state: &mut q3_error_state,
},
) {
Some(action)
} else if let Some(action) =
dispatch_qd3d::dispatch_q3_object_renderer_import_fast(
dispatch_qd3d::PpcQ3ObjectRendererDispatchContext {
target: &binding.dispatcher_target,
cpu,
memory,
stores: PpcQ3ObjectStores {
q3_objects: &mut q3_objects,
q3_object_refs: &mut q3_object_refs,
q3_renderer_preferences: &mut q3_renderer_preferences,
q3_files: &mut q3_files,
q3_group_memberships: &mut q3_group_memberships,
q3_file_groups: &mut q3_file_groups,
q3_views: &mut q3_views,
q3_submissions: &mut q3_submissions,
q3_view_transforms: &mut q3_view_transforms,
q3_submission_transforms: &mut q3_submission_transforms,
q3_view_materials: &mut q3_view_materials,
q3_submission_materials: &mut q3_submission_materials,
q3_submission_lights: &mut q3_submission_lights,
q3_view_state_stack: &mut q3_view_state_stack,
q3_completed_frames: &mut q3_completed_frames,
q3_retained_frames: &mut q3_retained_frames,
q3_fog_styles: &mut q3_fog_styles,
q3_memory_storages: &mut q3_memory_storages,
q3_attributes: &mut q3_attributes,
q3_shader_uv_transforms: &mut q3_shader_uv_transforms,
q3_shader_boundaries: &mut q3_shader_boundaries,
q3_mipmap_textures: &mut q3_mipmap_textures,
q3_texture_shaders: &mut q3_texture_shaders,
q3_draw_contexts: &mut q3_draw_contexts,
q3_trimeshes: &mut q3_trimeshes,
q3_styles: &mut q3_styles,
q3_cameras: &mut q3_cameras,
q3_lights: &mut q3_lights,
},
q3_error_state: &mut q3_error_state,
next_q3_object: &mut next_q3_object,
},
)
{
Some(action)
} else if let Some(action) = dispatch_qd3d::dispatch_q3_object_group_import_fast(
dispatch_qd3d::PpcQ3ObjectGroupDispatchContext {
target: &binding.dispatcher_target,
cpu,
memory,
q3_objects: &q3_objects,
q3_object_refs: &mut q3_object_refs,
q3_group_memberships: &q3_group_memberships,
q3_file_groups: &q3_file_groups,
q3_lights: &q3_lights,
q3_error_state: &mut q3_error_state,
},
) {
Some(action)
} else if let Some(action) = dispatch_simple_hot_import_fast(
&binding.dispatcher_target,
cpu,
memory,
ppc_virtual_microseconds(
process_tick,
clock_cycles_per_tick,
clock_cycle_phase,
elapsed,
),
) {
Some(action)
} else if let Some(action) = dispatch_qd3d::dispatch_q3_submit_import_fast(
dispatch_qd3d::PpcQ3SubmitDispatchContext {
target: &binding.dispatcher_target,
cpu,
memory,
q3_objects: &q3_objects,
q3_group_memberships: &q3_group_memberships,
q3_views: &mut q3_views,
q3_view_transforms: &mut q3_view_transforms,
q3_submissions: &mut q3_submissions,
q3_submission_transforms: &mut q3_submission_transforms,
q3_view_materials: &mut q3_view_materials,
q3_submission_materials: &mut q3_submission_materials,
q3_submission_lights: &mut q3_submission_lights,
q3_view_state_stack: &mut q3_view_state_stack,
q3_attributes: &q3_attributes,
q3_styles: &q3_styles,
q3_shader_boundaries: &q3_shader_boundaries,
q3_shader_uv_transforms: &q3_shader_uv_transforms,
q3_texture_shaders: &q3_texture_shaders,
q3_mipmap_textures: &q3_mipmap_textures,
q3_trimeshes: &q3_trimeshes,
q3_fog_styles: &mut q3_fog_styles,
q3_lights: &q3_lights,
q3_error_state: &mut q3_error_state,
},
) {
Some(action)
} else {
let action = process_file_system.with_mut(|file_system| {
let launched_app_path = file_system.launched_app_path.clone();
let ProcessFileSystemState {
files,
writable_refnums,
stdio_streams,
vfs_files,
deleted_vfs_file_paths,
resource_manager,
next_file_ref_num,
..
} = file_system;
screen_clut.with_mut(|screen_clut| {
color_manager_clut.with_mut(|color_manager_clut| {
event_queue.with_mut(|event_queue| {
controls.with_mut(|controls| {
list_manager.with_mut(|list_manager| {
writable_refnums.with_mut(|writable_refnums| {
vfs_directories.with_mut(|vfs_directories| {
working_directories.with_mut(|working_directories| {
next_working_directory_ref_num.with_mut(|next_working_directory_ref_num| {
application_working_directory_ref_num.with_mut(|application_working_directory_ref_num| {
next_vfs_dir_id.with_mut(|next_vfs_dir_id| {
current_resource_refnum.with_mut(|current_resource_refnum| {
resource_manager.with_mut(|resource_manager| {
let ProcessResourceManagerState {
resource_files,
vfs_resource_files,
vfs_resources,
..
} = resource_manager;
current_gworld.with_mut(|current_gworld| {
current_gdevice.with_mut(|current_gdevice| {
files.with_mut(|files| {
dispatch_supported_import(PpcDispatchContext {
binding,
cpu,
memory,
process_memory_manager: &mut *process_memory_manager,
heap_cursor: &mut heap_cursor,
heap_limit,
native_heap_ceiling,
last_mem_error: &mut last_mem_error,
tick_count: &mut import_tick_count,
cycles_per_tick: clock_cycles_per_tick,
current_resource_refnum,
last_resource_error: &mut last_resource_error,
resource_policy: &resource_policy,
native_exception_handler: &native_exception_handler,
stdc_qsort_stack: &mut stdc_qsort_stack,
dialog_callback_stack: &mut dialog_callback_stack,
collection_callback_stack: &mut collection_callback_stack,
apple_events: &mut apple_events,
cfm_connections: &mut cfm_connections,
cfm_library_fragments: &mut cfm_library_fragments,
next_cfm_connection_id: &mut next_cfm_connection_id,
import_run_state: &mut import_run_state,
controls,
aliases: &mut aliases,
gworlds: &mut gworlds,
gworld_pixel_states: &gworld_pixel_states,
window_list: &window_list,
q3_objects: &mut q3_objects,
q3_object_refs: &mut q3_object_refs,
next_q3_object: &mut next_q3_object,
q3_error_state: &mut q3_error_state,
q3_lifecycle: &mut q3_lifecycle,
q3_memory_storages: &mut q3_memory_storages,
q3_files: &mut q3_files,
q3_group_memberships: &mut q3_group_memberships,
q3_file_groups: &mut q3_file_groups,
q3_views: &mut q3_views,
q3_submissions: &mut q3_submissions,
q3_view_transforms: &mut q3_view_transforms,
q3_submission_transforms: &mut q3_submission_transforms,
q3_view_materials: &mut q3_view_materials,
q3_submission_materials: &mut q3_submission_materials,
q3_submission_lights: &mut q3_submission_lights,
q3_view_state_stack: &mut q3_view_state_stack,
q3_completed_frames: &mut q3_completed_frames,
q3_retained_frames: &mut q3_retained_frames,
q3_state_only_completed_frame_batches:
&mut q3_state_only_completed_frame_batches,
q3_fog_styles: &mut q3_fog_styles,
q3_attributes: &mut q3_attributes,
q3_shader_uv_transforms: &mut q3_shader_uv_transforms,
q3_shader_boundaries: &mut q3_shader_boundaries,
q3_mipmap_textures: &mut q3_mipmap_textures,
q3_texture_shaders: &mut q3_texture_shaders,
q3_renderer_preferences: &mut q3_renderer_preferences,
q3_draw_contexts: &mut q3_draw_contexts,
q3_trimeshes: &mut q3_trimeshes,
q3_styles: &mut q3_styles,
q3_cameras: &mut q3_cameras,
q3_lights: &mut q3_lights,
input_sprocket: &mut input_sprocket,
input_sprocket_virtual_elements:
&mut input_sprocket_virtual_elements,
toolbox_startup: &mut toolbox_startup,
quicktime: &mut quicktime,
sound: &mut sound,
timer_tasks: &timer_tasks,
vbl_tasks: &vbl_tasks,
callback_scheduling: &callback_scheduling,
files,
writable_refnums,
vfs_files,
stdio_streams,
deleted_vfs_file_paths,
resource_files,
vfs_resource_files,
vfs_resources,
next_file_ref_num,
current_gworld,
current_gdevice,
quickdraw_op_colors: &quickdraw_op_colors,
quickdraw_hilite_colors: &quickdraw_hilite_colors,
screen_clut,
color_manager_clut,
display_gamma: &display_gamma,
quickdraw_fore_color: &mut quickdraw_fore_color,
quickdraw_fore_indices: &mut quickdraw_fore_indices,
quickdraw_back_color: &mut quickdraw_back_color,
quickdraw_pen_h: &mut quickdraw_pen_h,
quickdraw_pen_v: &mut quickdraw_pen_v,
quickdraw_text_mode: &mut quickdraw_text_mode,
quickdraw_text_size: &mut quickdraw_text_size,
cursor_state: &cursor_state,
vfs_volumes: &vfs_volumes,
vfs_directories,
next_vfs_dir_id,
default_dir_id: *default_dir_id,
working_directories,
next_working_directory_ref_num,
application_working_directory_ref_num,
launched_app_path: launched_app_path.as_deref(),
param_text: ¶m_text,
scrap: &mut scrap,
list_manager,
collections: &collections,
input,
event_queue,
draw_sprocket: &mut draw_sprocket,
})
})
})
})
})
})
})
})
})
})
})
})
})
})
})
})
})
});
action
};
ppc_sync_process_window_list(memory, &window_list);
process_memory_manager.set_native_mem_error(last_mem_error);
let _ = memory.write_u16_be(
crate::memory::globals::addr::RES_ERR,
last_resource_error as u16,
);
process_file_system.resource_manager.with_mut(|resource_manager| {
ppc_publish_resource_fork_bytes(
&mut resource_manager.vfs_resource_files,
&resource_manager.vfs_resources,
true,
);
});
let current_default_dir_id = *default_dir_id;
let updated_default_dir_id = memory
.read_u32_be(crate::memory::globals::addr::CUR_DIR_STORE)
.unwrap_or(current_default_dir_id);
default_dir_id.with_mut(|default_dir_id| {
*default_dir_id = updated_default_dir_id;
});
match action {
Some(action) => {
let action = if binding.library_name == "InterfaceLib"
&& binding.symbol_name == "PBReadAsync"
&& matches!(action, PpcImportAction::Return(_))
{
let parameter_block = cpu.gpr[3];
let completion = memory.read_u32_be(parameter_block + 12).unwrap_or(0);
if completion != 0 {
pending_file_completions.push_back((parameter_block, completion));
cpu.gpr[3] = 0;
cpu.pc = cpu.lr;
PpcImportAction::Yield(0)
} else {
action
}
} else {
action
};
let action = ppc_import_action_with_extra_cycles(
action,
ppc_import_extra_cycles_for_binding(binding),
);
if trace_imports {
if let (Some(action_name), Some(result)) = (
ppc_draw_sprocket_action_name(&binding.dispatcher_target),
ppc_i16_return_value(&action),
) {
draw_sprocket_trace.push(ppc_draw_sprocket_trace_entry(
index,
cpu.pc,
memory,
cpu,
action_name,
result,
&draw_sprocket,
));
}
}
if trace_imports
&& binding.dispatcher_target
== PpcImportDispatcherTarget::ISpElementGetSimpleState
&& matches!(action, PpcImportAction::Return(0))
{
if let Some(entry) = ppc_isp_simple_state_trace_entry(
index,
cpu.pc,
cpu,
memory,
input,
input_sprocket,
&input_sprocket_virtual_elements,
) {
input_sprocket_trace.push(entry);
}
}
if trace_this_sprocket {
if let Some(entry) = entry.as_ref() {
eprintln!(
"{}",
format_sprocket_trace(
entry,
import_args,
&format_sprocket_action(&action),
&draw_sprocket,
&input_sprocket,
&input_sprocket_virtual_elements
)
);
}
}
if trace_this_qd3d {
if let (Some(entry), Some(before)) =
(entry.as_ref(), qd3d_before.as_ref())
{
let after = qd3d_trace_snapshot(
&q3_objects,
&q3_views,
&q3_submissions,
&q3_completed_frames,
&q3_state_only_completed_frame_batches,
&q3_memory_storages,
&q3_files,
&q3_group_memberships,
&q3_trimeshes,
&q3_draw_contexts,
&q3_mipmap_textures,
&q3_texture_shaders,
&q3_styles,
&q3_cameras,
&q3_lights,
);
eprintln!(
"{}",
format_qd3d_trace(
entry,
import_args,
&format_hle_import_action(&action),
before,
&after
)
);
}
}
handled_import_count = handled_import_count.saturating_add(1);
guest_calls.externalize_powerpc_action(cpu, action)
}
None => {
if trace_this_sprocket {
if let Some(entry) = entry.as_ref() {
eprintln!(
"{}",
format_sprocket_trace(
entry,
import_args,
"unsupported",
&draw_sprocket,
&input_sprocket,
&input_sprocket_virtual_elements
)
);
}
}
if trace_this_qd3d {
if let (Some(entry), Some(before)) =
(entry.as_ref(), qd3d_before.as_ref())
{
let after = qd3d_trace_snapshot(
&q3_objects,
&q3_views,
&q3_submissions,
&q3_completed_frames,
&q3_state_only_completed_frame_batches,
&q3_memory_storages,
&q3_files,
&q3_group_memberships,
&q3_trimeshes,
&q3_draw_contexts,
&q3_mipmap_textures,
&q3_texture_shaders,
&q3_styles,
&q3_cameras,
&q3_lights,
);
eprintln!(
"{}",
format_qd3d_trace(
entry,
import_args,
"unsupported",
before,
&after
)
);
}
}
unsupported_import_index = Some(index);
PpcImportAction::Halt
}
}
};
let mut total_cycles = 0u64;
loop {
let remaining_cycles = max_cycles.saturating_sub(total_cycles);
if remaining_cycles == 0 {
break PpcRunResult::CycleLimit {
cycles: total_cycles,
};
}
let step_result = if let Some(range) = ppc_watch_range() {
let mut write_observer = PpcWatchObserver { range };
self.cpu.run_with_imports_and_observers_and_cycle_handler(
&mut self.memory,
remaining_cycles,
self.halt_pc,
self.import_trap_base,
PPC_IMPORT_SLOT_COUNT,
&mut fetch_observer,
&mut write_observer,
&mut handle_import,
)
} else if needs_fetch_observer {
self.cpu
.run_with_imports_and_fetch_observer_and_cycle_handler(
&mut self.memory,
remaining_cycles,
self.halt_pc,
self.import_trap_base,
PPC_IMPORT_SLOT_COUNT,
&mut fetch_observer,
&mut handle_import,
)
} else {
self.cpu.run_with_imports_and_cycle_handler(
&mut self.memory,
remaining_cycles,
self.halt_pc,
self.import_trap_base,
PPC_IMPORT_SLOT_COUNT,
&mut handle_import,
)
};
total_cycles = total_cycles.saturating_add(ppc_run_result_cycles(step_result));
match step_result {
PpcRunResult::Exception { pc, exception, .. }
if native_exception_handler.get() != 0
&& ppc_native_exception_kind(exception).is_some() =>
{
let Some(context) = ppc_begin_native_exception(
&mut self.cpu,
&mut self.memory,
self.stack_base,
native_exception_handler.get(),
pc,
PpcNativeExceptionCause::Processor(exception),
) else {
break ppc_run_result_with_cycles(step_result, total_cycles);
};
native_exception_stack.push(context);
}
PpcRunResult::MemoryFault {
pc,
addr,
was_write,
..
} if native_exception_handler.get() != 0 => {
let Some(context) = ppc_begin_native_exception(
&mut self.cpu,
&mut self.memory,
self.stack_base,
native_exception_handler.get(),
pc,
PpcNativeExceptionCause::UnmappedMemory {
address: addr,
was_write,
},
) else {
break ppc_run_result_with_cycles(step_result, total_cycles);
};
native_exception_stack.push(context);
}
PpcRunResult::Halted { pc, .. }
if pc == self.halt_pc && !native_exception_stack.is_empty() =>
{
let context = native_exception_stack.pop().expect("checked nonempty");
let handler_result = self.cpu.gpr[3];
let restored =
ppc_restore_native_exception(&mut self.cpu, &mut self.memory, context)
.is_some();
if handler_result == 0 && restored {
continue;
}
native_exception_stack.clear();
break ppc_native_exception_result(context, total_cycles);
}
PpcRunResult::CycleLimit { .. } => {
break ppc_run_result_with_cycles(step_result, total_cycles);
}
_ => {
native_exception_stack.clear();
break ppc_run_result_with_cycles(step_result, total_cycles);
}
}
}
};
drop(fetch_observer);
self.native_exception_handler = native_exception_handler.get();
self.native_exception_stack = native_exception_stack;
self.stdc_qsort_stack = stdc_qsort_stack;
self.dialog_callback_stack = dialog_callback_stack;
self.collection_callback_stack = collection_callback_stack;
self.pending_file_completions = pending_file_completions;
self.apple_events = apple_events;
self.cfm = standalone_cfm;
(self.imports, self.import_count) = import_run_state.into_parts();
self.controls = controls;
self.aliases = aliases;
self.gworlds = gworlds;
self.q3_objects = q3_objects;
self.q3_object_refs = q3_object_refs;
self.next_q3_object = next_q3_object;
self.q3_error_state = q3_error_state;
self.q3_lifecycle = q3_lifecycle;
self.q3_memory_storages = q3_memory_storages;
self.q3_files = q3_files;
self.q3_group_memberships = q3_group_memberships;
self.q3_file_groups = q3_file_groups;
self.q3_views = q3_views;
self.q3_submissions = q3_submissions;
self.q3_view_transforms = q3_view_transforms;
self.q3_submission_transforms = q3_submission_transforms;
self.q3_view_materials = q3_view_materials;
self.q3_submission_materials = q3_submission_materials;
self.q3_submission_lights = q3_submission_lights;
self.q3_view_state_stack = q3_view_state_stack;
self.q3_completed_frames = q3_completed_frames;
self.q3_retained_frames = q3_retained_frames;
self.q3_state_only_completed_frame_batches = q3_state_only_completed_frame_batches;
self.q3_fog_styles = q3_fog_styles;
self.q3_attributes = q3_attributes;
self.q3_shader_uv_transforms = q3_shader_uv_transforms;
self.q3_shader_boundaries = q3_shader_boundaries;
self.q3_mipmap_textures = q3_mipmap_textures;
self.q3_texture_shaders = q3_texture_shaders;
self.q3_renderer_preferences = q3_renderer_preferences;
self.q3_draw_contexts = q3_draw_contexts;
self.q3_trimeshes = q3_trimeshes;
self.q3_styles = q3_styles;
self.q3_cameras = q3_cameras;
self.q3_lights = q3_lights;
self.input_sprocket = input_sprocket;
self.input_sprocket_virtual_elements = input_sprocket_virtual_elements;
self.toolbox_startup = toolbox_startup;
self.quicktime = quicktime;
self.sound = sound;
self.timer_tasks = timer_tasks;
self.vbl_tasks = vbl_tasks;
self.quickdraw_fore_color = quickdraw_fore_color;
self.quickdraw_fore_indices = quickdraw_fore_indices;
self.quickdraw_back_color = quickdraw_back_color;
self.quickdraw_pen_h = quickdraw_pen_h;
self.quickdraw_pen_v = quickdraw_pen_v;
self.quickdraw_text_mode = quickdraw_text_mode;
self.quickdraw_text_size = quickdraw_text_size;
self.cursor_state = cursor_state;
process_file_system.with_mut(ProcessFileSystemState::publish_native_vfs_catalogue);
self.scrap = scrap;
self.list_manager = list_manager;
self.event_queue = event_queue;
self.draw_sprocket = draw_sprocket;
if trace_recent_on_halt && !matches!(result, PpcRunResult::CycleLimit { .. }) {
let indirect = self.cpu.gpr[12];
eprintln!(
"[PPC-RECENT-IMPORTS] result={result:?} pc=${:08X} lr=${:08X} ctr=${:08X} r2=${:08X} r12=${:08X} indirect=({:?}, {:?})",
self.cpu.pc,
self.cpu.lr,
self.cpu.ctr,
self.cpu.gpr[2],
indirect,
self.memory.read_u32_be(indirect),
self.memory.read_u32_be(indirect.wrapping_add(4)),
);
for entry in &recent_imports {
eprintln!("{}", format_ppc_trace_import(entry));
}
}
PpcHleRunProbe {
result,
handled_import_count,
last_import_index,
unsupported_import_index,
import_trace,
draw_sprocket_trace,
input_sprocket_trace,
fetch_histogram: trace_fetches.then_some(fetch_histogram),
}
}
}
pub(super) fn ppc_front_buffer_for_gworld(gworlds: &[PpcGWorldRecord], gworld: u32) -> Option<PpcFrontBuffer> {
gworlds
.iter()
.find(|record| record.port == gworld)
.map(|record| PpcFrontBuffer {
base_addr: record.base_addr,
row_bytes: record.row_bytes,
width: record.width,
height: record.height,
depth: record.depth,
})
}
pub(super) fn ppc_live_front_buffer_for_gworld(
memory: &mut PpcSectionMem,
gworlds: &[PpcGWorldRecord],
gworld: u32,
) -> Option<PpcFrontBuffer> {
ppc_live_quickdraw_surface(memory, gworlds, gworld).map(|surface| surface.front_buffer)
}
pub(super) fn ppc_live_quickdraw_surface(
memory: &mut PpcSectionMem,
gworlds: &[PpcGWorldRecord],
gworld: u32,
) -> Option<PpcQuickDrawSurface> {
let record = gworlds.iter().find(|record| record.port == gworld);
let live_bits = gworld.checked_add(6).and_then(|row_bytes| {
let is_color = memory.read_u16_be(row_bytes)? & 0x8000 != 0;
let port_bits = gworld.checked_add(2)?;
if is_color {
let pixmap_handle = memory.read_u32_be(port_bits)?;
let pixmap = memory.read_u32_be(pixmap_handle)?;
let bits = ppc_read_pixmap_bits(memory, pixmap)?;
let ctable_handle = pixmap
.checked_add(42)
.and_then(|pm_table| memory.read_u32_be(pm_table))
.filter(|handle| *handle != 0);
Some((bits, ctable_handle))
} else {
let mut bits = ppc_read_pixmap_bits(memory, port_bits)?;
let row_capacity = bits.row_bytes.checked_mul(8)?.checked_div(bits.depth)?;
if bits.width > row_capacity {
let (top, left, bottom, right) = ppc_read_rect(memory, gworld + 16)?;
let (width, height) = ppc_rect_dimensions(top, left, bottom, right);
if width == 0 || height == 0 || width > row_capacity {
return None;
}
bits.top = top;
bits.left = left;
bits.bottom = bottom;
bits.right = right;
bits.width = width;
bits.height = height;
}
Some((bits, None))
}
});
live_bits
.map(|(bits, ctable_handle)| PpcQuickDrawSurface {
front_buffer: PpcFrontBuffer {
base_addr: bits.base_addr,
row_bytes: bits.row_bytes,
width: bits.width,
height: bits.height,
depth: bits.depth,
},
top: bits.top,
left: bits.left,
ctable_handle,
})
.or_else(|| {
let record = record?;
let ctable_handle = (record.pixmap != 0)
.then_some(record.pixmap)
.and_then(|pixmap| pixmap.checked_add(42))
.and_then(|pm_table| memory.read_u32_be(pm_table))
.filter(|handle| *handle != 0);
Some(PpcQuickDrawSurface {
front_buffer: PpcFrontBuffer {
base_addr: record.base_addr,
row_bytes: record.row_bytes,
width: record.width,
height: record.height,
depth: record.depth,
},
top: 0,
left: 0,
ctable_handle,
})
})
}
fn ppc_live_gworld_ctable_handle(
memory: &mut PpcSectionMem,
gworlds: &[PpcGWorldRecord],
gworld: u32,
) -> Option<u32> {
let record = gworlds.iter().find(|record| record.port == gworld)?;
let live_pixmap = gworld
.checked_add(6)
.and_then(|row_bytes| memory.read_u16_be(row_bytes))
.filter(|row_bytes| row_bytes & 0x8000 != 0)
.and_then(|_| gworld.checked_add(2))
.and_then(|port_bits| memory.read_u32_be(port_bits))
.and_then(|pixmap_handle| memory.read_u32_be(pixmap_handle));
live_pixmap
.or_else(|| (record.pixmap != 0).then_some(record.pixmap))
.and_then(|pixmap| pixmap.checked_add(42))
.and_then(|pm_table| memory.read_u32_be(pm_table))
.filter(|ctable_handle| *ctable_handle != 0)
}
fn ppc_live_gworld_clut(
memory: &mut PpcSectionMem,
gworlds: &[PpcGWorldRecord],
gworld: u32,
_screen_clut: &[[u16; 3]; 256],
color_manager_clut: &[[u16; 3]; 256],
) -> [[u16; 3]; 256] {
let Some(ctable_handle) = ppc_live_gworld_ctable_handle(memory, gworlds, gworld) else {
return *color_manager_clut;
};
ppc_read_ctable_clut(memory, ctable_handle, color_manager_clut).unwrap_or(*color_manager_clut)
}
fn ppc_front_buffer_8bpp_pixel_addr(
front_buffer: PpcFrontBuffer,
(x, y): (i32, i32),
) -> Option<u32> {
if x < 0 || y < 0 || front_buffer.depth != 8 {
return None;
}
let (x, y) = (x as u32, y as u32);
if x >= front_buffer.width || y >= front_buffer.height || x >= front_buffer.row_bytes {
return None;
}
front_buffer
.base_addr
.checked_add(y.checked_mul(front_buffer.row_bytes)?)?
.checked_add(x)
}
#[cfg(test)]
fn ppc_rgb_color_to_8bpp_index(color: PpcRgbColor) -> u8 {
ppc_rgb_color_to_8bpp_index_in_clut(color, &TrapDispatcher::standard_mac_8bpp_clut())
}
#[cfg(test)]
fn ppc_rgb_color_to_8bpp_index_in_clut(color: PpcRgbColor, clut: &[[u16; 3]; 256]) -> u8 {
ppc_rgb555_to_clut_index(ppc_rgb_color_to_rgb555(color), clut)
}
pub(super) fn ppc_indexed_depth_entry_count(depth: u32) -> Option<usize> {
matches!(depth, 1 | 2 | 4 | 8).then(|| 1usize << depth)
}
pub(super) fn ppc_rgb_color_to_index_in_clut(
color: PpcRgbColor,
clut: &[[u16; 3]; 256],
entry_count: usize,
) -> u8 {
ppc_rgb_color_to_valid_index_in_clut(color, clut, &[true; 256], entry_count).unwrap_or(0)
}
fn ppc_rgb_color_to_valid_index_in_clut(
color: PpcRgbColor,
clut: &[[u16; 3]; 256],
valid: &[bool; 256],
entry_count: usize,
) -> Option<u8> {
let target = ppc_rgb_color_to_rgb555(color);
let target_r = i64::from((target >> 10) & 0x1f);
let target_g = i64::from((target >> 5) & 0x1f);
let target_b = i64::from(target & 0x1f);
clut.iter()
.take(entry_count.min(clut.len()))
.enumerate()
.filter(|(index, _)| valid[*index])
.min_by_key(|(_, [red, green, blue])| {
let red = i64::from(*red >> 11);
let green = i64::from(*green >> 11);
let blue = i64::from(*blue >> 11);
(red - target_r).pow(2) + (green - target_g).pow(2) + (blue - target_b).pow(2)
})
.map(|(index, _)| index as u8)
}
pub(super) fn ppc_quickdraw_surface_color_pixel(
memory: &mut PpcSectionMem,
surface: PpcQuickDrawSurface,
color: PpcRgbColor,
) -> Option<u16> {
match surface.front_buffer.depth {
depth @ (1 | 2 | 4 | 8) => {
let fallback = TrapDispatcher::standard_mac_indexed_clut(depth as u16)
.map(|(clut, _)| clut)
.unwrap_or_else(TrapDispatcher::standard_mac_8bpp_clut);
let clut = surface
.ctable_handle
.and_then(|handle| ppc_read_ctable_clut(memory, handle, &fallback))
.unwrap_or(fallback);
Some(u16::from(ppc_rgb_color_to_index_in_clut(
color,
&clut,
ppc_indexed_depth_entry_count(depth)?,
)))
}
16 => Some(ppc_rgb_color_to_rgb555(color)),
_ => None,
}
}
pub(super) fn ppc_quickdraw_surface_fore_pixel(
memory: &mut PpcSectionMem,
surface: PpcQuickDrawSurface,
color: PpcRgbColor,
explicit_index: Option<u8>,
) -> Option<u16> {
if let Some(entry_count) = ppc_indexed_depth_entry_count(surface.front_buffer.depth) {
if let Some(index) = explicit_index {
return Some(u16::from(index) & (entry_count as u16 - 1));
}
}
ppc_quickdraw_surface_color_pixel(memory, surface, color)
}
pub(super) fn ppc_quickdraw_write_pixel(
memory: &mut PpcSectionMem,
front_buffer: PpcFrontBuffer,
point: (i32, i32),
color: PpcRgbColor,
) -> bool {
match front_buffer.depth {
depth @ (1 | 2 | 4 | 8) => {
let fallback = TrapDispatcher::standard_mac_indexed_clut(depth as u16)
.map(|(clut, _)| clut)
.unwrap_or_else(TrapDispatcher::standard_mac_8bpp_clut);
let clut = if front_buffer.base_addr == PPC_MAIN_SCREEN_BASE {
ppc_read_ctable_clut(memory, PPC_MAIN_CTABLE_HANDLE, &fallback).unwrap_or(fallback)
} else {
fallback
};
let pixel = ppc_rgb_color_to_index_in_clut(
color,
&clut,
ppc_indexed_depth_entry_count(depth).unwrap_or(1),
);
ppc_quickdraw_write_raw_pixel(memory, front_buffer, point, u16::from(pixel))
}
16 => {
ppc_q3_write_software_pixel(memory, front_buffer, point, ppc_rgb_color_to_rgb555(color))
}
_ => false,
}
}
pub(super) fn ppc_quickdraw_read_pixel(
memory: &mut PpcSectionMem,
front_buffer: PpcFrontBuffer,
point: (i32, i32),
) -> Option<u16> {
match front_buffer.depth {
depth @ (1 | 2 | 4) => {
let (x, y) = point;
let x = u32::try_from(x).ok()?;
let y = u32::try_from(y).ok()?;
if x >= front_buffer.width || y >= front_buffer.height {
return None;
}
let pixels_per_byte = 8 / depth;
let byte_offset = x / pixels_per_byte;
if byte_offset >= front_buffer.row_bytes {
return None;
}
let byte = memory.read_u8(
front_buffer
.base_addr
.checked_add(y.checked_mul(front_buffer.row_bytes)?)?
.checked_add(byte_offset)?,
)?;
let shift = 8 - depth - (x % pixels_per_byte) * depth;
let mask = (1u8 << depth) - 1;
Some(u16::from((byte >> shift) & mask))
}
8 => memory
.read_u8(ppc_front_buffer_8bpp_pixel_addr(front_buffer, point)?)
.map(u16::from),
16 => ppc_q3_read_software_pixel(memory, front_buffer, point),
_ => None,
}
}
pub(super) fn ppc_quickdraw_write_raw_pixel(
memory: &mut PpcSectionMem,
front_buffer: PpcFrontBuffer,
point: (i32, i32),
value: u16,
) -> bool {
match front_buffer.depth {
depth @ (1 | 2 | 4) => {
let (x, y) = point;
let (Ok(x), Ok(y)) = (u32::try_from(x), u32::try_from(y)) else {
return false;
};
if x >= front_buffer.width || y >= front_buffer.height {
return false;
}
let Some(row_offset) = y.checked_mul(front_buffer.row_bytes) else {
return false;
};
let pixels_per_byte = 8 / depth;
let byte_offset = x / pixels_per_byte;
if byte_offset >= front_buffer.row_bytes {
return false;
}
let Some(addr) = front_buffer
.base_addr
.checked_add(row_offset)
.and_then(|row| row.checked_add(byte_offset))
else {
return false;
};
let Some(byte) = memory.read_u8(addr) else {
return false;
};
let shift = 8 - depth - (x % pixels_per_byte) * depth;
let value_mask = (1u8 << depth) - 1;
let pixel_mask = value_mask << shift;
let packed = ((value as u8) & value_mask) << shift;
memory
.write_u8(addr, (byte & !pixel_mask) | packed)
.is_some()
}
8 => {
let Some(addr) = ppc_front_buffer_8bpp_pixel_addr(front_buffer, point) else {
return false;
};
memory.write_u8(addr, value as u8).is_some()
}
16 => ppc_q3_write_software_pixel(memory, front_buffer, point, value),
_ => false,
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PpcRelocationImportSymbol {
pub symbol_index: u32,
pub library_name: String,
pub symbol_name: String,
pub class: u8,
pub weak: bool,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PpcLoadError {
PefParse,
SectionInstantiation,
NoCodeSection,
NoDataSection,
MainSectionMissing {
section_index: i32,
},
MainTVectorOutOfRange {
section_index: i32,
offset: u32,
},
RelocationStream {
section_index: u16,
},
RelocationApply {
section_index: u16,
reloc_instr_offset: u32,
section_position: u32,
import_index: Option<u32>,
import_symbol: Option<PpcRelocationImportSymbol>,
error: PefRelocApplyError,
},
ImportBindingOutOfRange {
symbol_index: u32,
import_count: u32,
},
ImportCapacityExceeded {
import_count: u32,
capacity: u32,
},
StackSizeOutOfRange {
requested: u32,
},
ScreenDepthOutOfRange {
requested: u32,
},
BundledLibraryLoad {
library_name: String,
error: i16,
},
AddressOverflow,
}
struct PpcInitialCfmLibraryPlan {
library_name: String,
fragment_bytes: Vec<u8>,
plan: CfmFragmentPlan,
}
struct PpcInitialCfmPlan {
libraries: Vec<PpcInitialCfmLibraryPlan>,
connections: Vec<PpcCfmConnection>,
imports: Vec<PpcImportBinding>,
import_addresses: Vec<u32>,
import_count: u32,
heap_cursor: u32,
next_connection_id: u32,
}
fn initial_cfm_library_order(
fragments: &[PpcCfmLibraryFragment],
application_imports: &[crate::loader::pef::PefResolvedImport],
) -> Vec<usize> {
fn visit(
index: usize,
fragments: &[PpcCfmLibraryFragment],
visiting: &mut HashSet<usize>,
visited: &mut HashSet<usize>,
order: &mut Vec<usize>,
) {
if visited.contains(&index) || !visiting.insert(index) {
return;
}
let mut dependencies: Vec<_> = resolve_pef_imports(&fragments[index].bytes)
.unwrap_or_default()
.into_iter()
.filter_map(|import| {
fragments.iter().position(|fragment| {
fragment.name.eq_ignore_ascii_case(&import.library_name)
})
})
.collect();
dependencies.sort_unstable();
dependencies.dedup();
for dependency in dependencies {
visit(dependency, fragments, visiting, visited, order);
}
visiting.remove(&index);
if visited.insert(index) {
order.push(index);
}
}
let mut roots: Vec<_> = application_imports
.iter()
.filter_map(|import| {
fragments.iter().position(|fragment| {
fragment.name.eq_ignore_ascii_case(&import.library_name)
})
})
.collect();
roots.sort_unstable();
roots.dedup();
let mut visiting = HashSet::new();
let mut visited = HashSet::new();
let mut order = Vec::new();
for root in roots {
visit(
root,
fragments,
&mut visiting,
&mut visited,
&mut order,
);
}
order
}
fn ppc_plan_initial_cfm_libraries(
mut fragments: Vec<PpcCfmLibraryFragment>,
application_imports: Vec<crate::loader::pef::PefResolvedImport>,
application_import_count: usize,
initial_imports: Vec<PpcImportBinding>,
heap_limit: u32,
) -> Result<PpcInitialCfmPlan, PpcLoadError> {
fragments.retain(|fragment| {
!fragment.name.eq_ignore_ascii_case("DrawSprocketLib")
&& !fragment.name.eq_ignore_ascii_case("InputSprocketLib")
});
fragments.sort_by(|left, right| {
left.name
.to_ascii_lowercase()
.cmp(&right.name.to_ascii_lowercase())
.then_with(|| left.name.cmp(&right.name))
});
fragments.dedup_by(|left, right| left.name.eq_ignore_ascii_case(&right.name));
let order = initial_cfm_library_order(&fragments, &application_imports);
let initial_binding_count = initial_imports.len();
let mut import_run_state = PpcImportRunState::from_parts(
initial_imports,
application_import_count as u32,
ppc_import_layout(),
);
let mut libraries = Vec::new();
let mut connections = Vec::new();
let mut heap_cursor = PPC_HEAP_BASE;
let mut next_connection_id = PPC_FIRST_CFM_CONNECTION_ID;
for index in order {
let fragment = &fragments[index];
let imported_symbols = parse_pef_imported_symbols(&fragment.bytes).ok_or_else(|| {
PpcLoadError::BundledLibraryLoad {
library_name: fragment.name.clone(),
error: PPC_FRAG_CORRUPT_ERR,
}
})?;
let resolved_imports = resolve_pef_imports(&fragment.bytes).ok_or_else(|| {
PpcLoadError::BundledLibraryLoad {
library_name: fragment.name.clone(),
error: PPC_FRAG_CORRUPT_ERR,
}
})?;
let policy = PpcConnectedCfmBindingPolicy {
connections: &connections,
};
let import_plan = import_run_state
.plan_resolved(resolved_imports, imported_symbols.len(), &policy)
.map_err(|error| PpcLoadError::BundledLibraryLoad {
library_name: fragment.name.clone(),
error: ppc_dynamic_import_error(error),
})?;
let pending = import_run_state
.stage_append(import_plan)
.map_err(|error| PpcLoadError::BundledLibraryLoad {
library_name: fragment.name.clone(),
error: ppc_dynamic_import_error(error),
})?;
let plan = CfmFragmentPlan::prepare(
&fragment.bytes,
pending.relocation_addresses(),
heap_cursor,
heap_limit,
PPC_HEAP_ALIGNMENT,
|cursor, size, alignment| {
let base = cursor.checked_add(alignment.checked_sub(1)?)? & !(alignment - 1);
let next = base.checked_add(size)?;
(next < heap_limit).then_some((base, next))
},
)
.map_err(|error| PpcLoadError::BundledLibraryLoad {
library_name: fragment.name.clone(),
error: error.os_error(),
})?;
heap_cursor = plan.next_heap_cursor();
pending.commit();
let prepared = plan.prepared_fragment();
connections.push(PpcCfmConnection {
id: next_connection_id,
library_name: fragment.name.clone(),
main_addr: prepared.main_addr,
init_addr: prepared.init_addr,
term_addr: prepared.term_addr,
exports: prepared.exports.clone(),
});
next_connection_id = next_connection_id
.checked_add(1)
.ok_or(PpcLoadError::AddressOverflow)?;
libraries.push(PpcInitialCfmLibraryPlan {
library_name: fragment.name.clone(),
fragment_bytes: fragment.bytes.clone(),
plan,
});
}
let policy = PpcConnectedCfmBindingPolicy {
connections: &connections,
};
let rebound = PpcImportBindingPlan::prepare(
application_imports,
application_import_count,
0,
ppc_import_layout(),
&policy,
)
.map_err(ppc_initial_import_error)?;
let import_addresses = rebound.relocation_addresses().to_vec();
let rebound_imports = rebound.into_initial_bindings();
let (mut imports, import_count) = import_run_state.into_parts();
imports.splice(0..initial_binding_count, rebound_imports);
Ok(PpcInitialCfmPlan {
libraries,
connections,
imports,
import_addresses,
import_count,
heap_cursor,
next_connection_id,
})
}
pub fn load_pef_application(data: &[u8]) -> Result<PpcLoadedApp, PpcLoadError> {
load_pef_application_with_config(data, PpcLoadConfig::default())
}
pub fn load_pef_application_with_config(
data: &[u8],
config: PpcLoadConfig,
) -> Result<PpcLoadedApp, PpcLoadError> {
load_pef_application_with_config_and_optional_system_reservation(
data,
config,
None,
Vec::new(),
None,
)
}
#[cfg(test)]
pub(crate) fn load_pef_application_with_config_and_system_reservation(
data: &[u8],
config: PpcLoadConfig,
system_reservation: (u32, u32),
) -> Result<PpcLoadedApp, PpcLoadError> {
load_pef_application_with_config_and_optional_system_reservation(
data,
config,
Some(system_reservation),
Vec::new(),
None,
)
}
pub(crate) fn load_pef_application_with_config_and_system_reservation_and_libraries(
data: &[u8],
config: PpcLoadConfig,
system_reservation: (u32, u32),
library_fragments: Vec<PpcCfmLibraryFragment>,
) -> Result<PpcLoadedApp, PpcLoadError> {
load_pef_application_with_config_and_optional_system_reservation(
data,
config,
Some(system_reservation),
library_fragments,
None,
)
}
pub(crate) fn load_pef_application_with_named_fragment_and_libraries(
data: &[u8],
config: PpcLoadConfig,
system_reservation: (u32, u32),
library_fragments: Vec<PpcCfmLibraryFragment>,
fragment_name: &str,
) -> Result<PpcLoadedApp, PpcLoadError> {
load_pef_application_with_config_and_optional_system_reservation(
data,
config,
Some(system_reservation),
library_fragments,
Some(fragment_name),
)
}
fn load_pef_application_with_config_and_optional_system_reservation(
data: &[u8],
config: PpcLoadConfig,
system_reservation: Option<(u32, u32)>,
library_fragments: Vec<PpcCfmLibraryFragment>,
application_fragment_name: Option<&str>,
) -> Result<PpcLoadedApp, PpcLoadError> {
if !matches!(config.screen_depth, 1 | 2 | 4 | 8 | 16) {
return Err(PpcLoadError::ScreenDepthOutOfRange {
requested: config.screen_depth,
});
}
let header = parse_pef_header(data).ok_or(PpcLoadError::PefParse)?;
let raw_sections = parse_pef_sections(data).ok_or(PpcLoadError::PefParse)?;
let loader = parse_pef_loader_header(data).ok_or(PpcLoadError::PefParse)?;
let resolved_imports = resolve_pef_imports(data).unwrap_or_default();
let imported_symbols = parse_pef_imported_symbols(data).unwrap_or_default();
let stack_size = normalize_stack_size(config.stack_size)?;
let stack_base =
PPC_STACK_TOP
.checked_sub(stack_size)
.ok_or(PpcLoadError::StackSizeOutOfRange {
requested: config.stack_size,
})?;
if stack_base <= PPC_HEAP_BASE {
return Err(PpcLoadError::StackSizeOutOfRange {
requested: config.stack_size,
});
}
let import_plan = PpcImportBindingPlan::prepare(
resolved_imports.clone(),
imported_symbols.len(),
0,
ppc_import_layout(),
&SystemlessPpcImportBindingPolicy,
)
.map_err(ppc_initial_import_error)?;
let initial_imports = import_plan.into_initial_bindings();
let mut mapped_sections = map_instantiated_sections(data)?;
let section_bases = section_bases(&mapped_sections);
let code_base = first_base_for_kind(&mapped_sections, SECTION_KIND_CODE)
.ok_or(PpcLoadError::NoCodeSection)?;
let data_base = first_data_base(&mapped_sections).ok_or(PpcLoadError::NoDataSection)?;
let initial_cfm = ppc_plan_initial_cfm_libraries(
library_fragments.clone(),
resolved_imports,
imported_symbols.len(),
initial_imports,
stack_base,
)?;
let import_addrs = &initial_cfm.import_addresses;
let imports = &initial_cfm.imports;
let reloc_headers = parse_pef_reloc_headers(data).unwrap_or_default();
for reloc in &reloc_headers {
let stream = pef_reloc_chunk_stream(data, reloc).ok_or(PpcLoadError::RelocationStream {
section_index: reloc.section_index,
})?;
let mapped = mapped_sections
.iter_mut()
.find(|section| section.index == usize::from(reloc.section_index))
.ok_or(PpcLoadError::RelocationStream {
section_index: reloc.section_index,
})?;
let ctx = PefRelocContext {
code_base,
data_base,
section_bases: §ion_bases,
import_addrs,
};
apply_pef_relocations_detailed(&mut mapped.bytes, stream, &ctx).map_err(|failure| {
let import_symbol = failure
.import_index
.and_then(|index| relocation_import_symbol(imports, index));
PpcLoadError::RelocationApply {
section_index: reloc.section_index,
reloc_instr_offset: reloc
.first_reloc_offset
.checked_add(failure.reloc_offset)
.unwrap_or(u32::MAX),
section_position: failure.section_position,
import_index: failure.import_index,
import_symbol,
error: failure.error,
}
})?;
}
let application_exports = if application_fragment_name.is_some() {
resolve_fragment_exports(data, &mapped_sections, import_addrs)
.map_err(|_| PpcLoadError::PefParse)?
} else {
Vec::new()
};
let main_section = mapped_sections
.iter()
.find(|section| section.index == usize::try_from(loader.main_section).unwrap_or(usize::MAX))
.ok_or(PpcLoadError::MainSectionMissing {
section_index: loader.main_section,
})?;
let main_offset =
usize::try_from(loader.main_offset).map_err(|_| PpcLoadError::MainTVectorOutOfRange {
section_index: loader.main_section,
offset: loader.main_offset,
})?;
let tvector_end = main_offset
.checked_add(8)
.ok_or(PpcLoadError::MainTVectorOutOfRange {
section_index: loader.main_section,
offset: loader.main_offset,
})?;
if tvector_end > main_section.bytes.len() {
return Err(PpcLoadError::MainTVectorOutOfRange {
section_index: loader.main_section,
offset: loader.main_offset,
});
}
let entry_pc =
read_u32(&main_section.bytes, main_offset).ok_or(PpcLoadError::MainTVectorOutOfRange {
section_index: loader.main_section,
offset: loader.main_offset,
})?;
let rtoc = read_u32(&main_section.bytes, main_offset + 4).ok_or(
PpcLoadError::MainTVectorOutOfRange {
section_index: loader.main_section,
offset: loader.main_offset,
},
)?;
let special_tvector = |section_index: i32, offset: u32| -> Option<(u32, u32, u32)> {
if section_index < 0 {
return None;
}
let section_index = usize::try_from(section_index).ok()?;
let section = mapped_sections
.iter()
.find(|section| section.index == section_index)?;
let offset = usize::try_from(offset).ok()?;
let entry = read_u32(§ion.bytes, offset)?;
let rtoc = read_u32(§ion.bytes, offset.checked_add(4)?)?;
let descriptor = section.base.checked_add(offset as u32)?;
Some((descriptor, entry, rtoc))
};
let init_tvector = special_tvector(loader.init_section, loader.init_offset);
let term_tvector = special_tvector(loader.term_section, loader.term_offset);
if loader.init_section >= 0 && init_tvector.is_none() {
return Err(PpcLoadError::PefParse);
}
if loader.term_section >= 0 && term_tvector.is_none() {
return Err(PpcLoadError::PefParse);
}
let main_tvector = main_section.base + loader.main_offset;
maybe_write(&PefDumpContext {
data_len: data.len(),
header,
loader,
raw_sections: &raw_sections,
mapped_sections: &mapped_sections,
imports,
reloc_headers: &reloc_headers,
entry_pc,
rtoc,
stack_base,
stack_size,
stack_top: PPC_STACK_TOP,
});
let PpcInitialCfmPlan {
libraries: initial_library_plans,
connections: mut cfm_connections,
imports,
import_count,
mut heap_cursor,
next_connection_id: mut next_cfm_connection_id,
..
} = initial_cfm;
let has_initial_library_initializer = initial_library_plans
.iter()
.any(|library| library.plan.prepared_fragment().init_addr != 0);
let mut memory = PpcSectionMem::new();
if let Some((base, len)) = system_reservation {
memory
.add_readonly_allocation_exclusion(base, len)
.ok_or(PpcLoadError::AddressOverflow)?;
}
memory.add_region(PPC_HALT_PC, vec![0u8; PPC_LOW_MEMORY_SIZE]);
let _ = memory.write_u16_be(
crate::memory::globals::addr::SYS_EVT_MASK,
crate::memory::globals::DEFAULT_SYS_EVT_MASK,
);
let _ = memory.write_u16_be(
crate::memory::globals::addr::MENU_FLASH,
crate::memory::globals::DEFAULT_MENU_FLASH_COUNT,
);
let _ = memory.write_u16_be(crate::memory::globals::addr::RES_LOAD, 0x0100);
let _ = memory.write_u32_be(
crate::memory::globals::addr::DEFLT_STACK,
crate::memory::globals::DEFAULT_DEFLT_STACK_SIZE,
);
let _ = memory.write_u32_be(
crate::memory::globals::addr::CUR_STACK_BASE,
stack_base,
);
let _ = memory.write_u16_be(PPC_MBAR_HEIGHT_ADDR, 20);
let _ = memory.write_u16_be(PPC_THE_MENU_ADDR, 0);
let _ = memory.write_u16_be(0x09dc, 1);
let _ = memory.write_u8(PPC_MMU_32BIT_ADDR, 1);
let _ = memory.write_u32_be(
crate::memory::globals::addr::DOUBLE_TIME,
PPC_DEFAULT_DOUBLE_TIME_TICKS,
);
let _ = memory.write_u8(crate::memory::globals::addr::SD_VOLUME, 1);
memory.add_region(
PPC_CLASSIC_APP_MEMORY_BASE,
vec![0u8; PPC_CLASSIC_APP_MEMORY_SIZE],
);
for section in mapped_sections {
if section.section_kind == SECTION_KIND_CODE
|| section.section_kind == SECTION_KIND_CONSTANT
{
memory.add_readonly_region(section.base, section.bytes);
} else {
memory.add_region(section.base, section.bytes);
}
}
memory
.publish_system_code(
GuestIsa::PowerPc,
PPC_IMPORT_TVECTOR_BASE,
import_tvector_bytes(PPC_IMPORT_SLOT_COUNT as usize),
)
.ok_or(PpcLoadError::AddressOverflow)?;
memory
.publish_system_code(
GuestIsa::PowerPc,
PPC_IMPORT_TRAP_BASE,
import_trap_bytes(PPC_IMPORT_SLOT_COUNT as usize),
)
.ok_or(PpcLoadError::AddressOverflow)?;
memory.add_region(PPC_IMPORT_DATA_BASE, vec![0; PPC_IMPORT_DATA_SIZE]);
ppc_seed_import_data(&mut memory);
memory
.publish_system_code(
GuestIsa::PowerPc,
PPC_CFM_MAIN_STUB_BASE,
import_trap_bytes(PPC_CFM_MAIN_STUB_COUNT as usize),
)
.ok_or(PpcLoadError::AddressOverflow)?;
memory.add_region(PPC_MAIN_GWORLD, vec![0u8; 256]);
memory.add_region(PPC_MAIN_GDEVICE, vec![0u8; 256]);
memory.add_region(PPC_MAIN_GDEVICE_RECORD, vec![0u8; 256]);
memory.add_region(PPC_MAIN_PIXMAP_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_MAIN_PIXMAP, vec![0u8; PPC_PIXMAP_SIZE as usize]);
memory.add_region(PPC_GRAY_RGN_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_GRAY_RGN, vec![0u8; 10]);
memory.add_region(PPC_MAIN_DCE_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_MAIN_DCE, vec![0u8; 52]);
memory.add_region(PPC_MAIN_CTABLE_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_MAIN_CTABLE, vec![0u8; PPC_MAIN_CTABLE_SIZE as usize]);
memory.add_region(PPC_MAIN_VIS_RGN_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_MAIN_VIS_RGN, vec![0u8; 10]);
memory.add_region(PPC_MAIN_CLIP_RGN_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_MAIN_CLIP_RGN, vec![0u8; 10]);
let mut gamma_table = vec![0u8; PPC_MAIN_GAMMA_TABLE_SIZE as usize];
gamma_table[6..8].copy_from_slice(&1u16.to_be_bytes()); gamma_table[8..10].copy_from_slice(&256u16.to_be_bytes()); gamma_table[10..12].copy_from_slice(&8u16.to_be_bytes()); for (value, output) in gamma_table[12..].iter_mut().enumerate() {
*output = value as u8;
}
memory.add_readonly_region(PPC_MAIN_GAMMA_TABLE, gamma_table);
memory.add_region(PPC_PORT_LIST_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_PORT_LIST, vec![0u8; 2]);
memory.add_region(PPC_UNIT_TABLE, vec![0u8; 64 * 4]);
memory.add_region(PPC_SOUND_DCE_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_SOUND_DCE, vec![0u8; 52]);
let _ = memory.write_u32_be(PPC_PORT_LIST_ADDR, PPC_PORT_LIST_HANDLE);
let _ = memory.write_u32_be(PPC_PORT_LIST_HANDLE, PPC_PORT_LIST);
let _ = memory.write_u16_be(PPC_PORT_LIST, 0);
let _ = memory.write_u32_be(PPC_SOUND_DCE_HANDLE, PPC_SOUND_DCE);
let _ = memory.write_u16_be(PPC_SOUND_DCE + 24, (-4i16) as u16);
let _ = memory.write_u32_be(PPC_UNIT_TABLE + 3 * 4, PPC_SOUND_DCE_HANDLE);
memory.add_region(PPC_APPLICATION_ZONE, vec![0u8; PPC_ZONE_STORAGE_SIZE]);
memory.add_region(PPC_SYSTEM_ZONE, vec![0u8; PPC_ZONE_STORAGE_SIZE]);
ppc_seed_zone_header(
&mut memory,
PPC_APPLICATION_ZONE,
PPC_HEAP_BASE,
stack_base,
64,
);
ppc_seed_zone_header(&mut memory, PPC_SYSTEM_ZONE, PPC_HEAP_BASE, stack_base, 32);
let _ = memory.write_u32_be(PPC_THE_ZONE_ADDR, PPC_APPLICATION_ZONE);
let _ = memory.write_u32_be(PPC_APPL_ZONE_ADDR, PPC_APPLICATION_ZONE);
let _ = memory.write_u32_be(PPC_SYS_ZONE_ADDR, PPC_SYSTEM_ZONE);
if !ppc_main_screen_fits() {
return Err(PpcLoadError::AddressOverflow);
}
memory.add_region(
PPC_MAIN_SCREEN_BASE,
vec![0u8; ppc_main_screen_buffer_size() as usize],
);
memory.add_region(PPC_DSP_BACK_GWORLD, vec![0u8; 256]);
memory.add_region(PPC_DSP_BACK_PIXMAP_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_DSP_BACK_PIXMAP, vec![0u8; PPC_PIXMAP_SIZE as usize]);
memory.add_region(PPC_DSP_BACK_VIS_RGN_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_DSP_BACK_VIS_RGN, vec![0u8; 10]);
memory.add_region(PPC_DSP_BACK_CLIP_RGN_HANDLE, vec![0u8; 4]);
memory.add_region(PPC_DSP_BACK_CLIP_RGN, vec![0u8; 10]);
memory.add_region(
PPC_DSP_BACK_SCREEN_BASE,
vec![0u8; ppc_main_screen_buffer_size() as usize],
);
memory.add_region(PPC_DSP_CONTEXT, vec![0u8; PPC_QA_OBJECTS_SIZE]);
ppc_seed_qa_rave_objects(&mut memory);
if init_tvector.is_some() && !has_initial_library_initializer {
memory
.publish_system_code(
GuestIsa::PowerPc,
PPC_APPLICATION_INIT_RETURN_PC,
ppc_application_init_return_trampoline(entry_pc, rtoc),
)
.ok_or(PpcLoadError::AddressOverflow)?;
}
let mut gworlds = vec![
ppc_seed_main_gworld(&mut memory),
ppc_seed_dsp_back_gworld(&mut memory),
];
let gworld_pixel_states = SharedProcessQuickDrawPixelStates::default();
if let Some((base, len)) = system_reservation {
let reservation_start = u64::from(base);
let reservation_end = reservation_start + u64::from(len);
let overlaps_stack =
reservation_start < u64::from(PPC_STACK_TOP) && u64::from(stack_base) < reservation_end;
if overlaps_stack || memory.mapping_overlaps(base, len) {
return Err(PpcLoadError::AddressOverflow);
}
}
memory.add_region(
PPC_HEAP_BASE,
vec![0u8; usize::try_from(stack_base - PPC_HEAP_BASE).unwrap()],
);
for library in &initial_library_plans {
if !library.plan.publish(&mut memory) {
return Err(PpcLoadError::BundledLibraryLoad {
library_name: library.library_name.clone(),
error: PPC_FRAG_NO_ADDR_SPACE,
});
}
}
ppc_update_zone_free_bytes(&mut memory, heap_cursor, stack_base);
let mut startup_initializers = Vec::new();
for library in &initial_library_plans {
let connection = cfm_connections
.iter()
.find(|connection| connection.library_name == library.library_name)
.expect("planned CFM library has a connection");
if connection.init_addr == 0 {
continue;
}
let fragment_size = u32::try_from(library.fragment_bytes.len())
.map_err(|_| PpcLoadError::AddressOverflow)?;
let fragment_addr = ppc_heap_alloc(
&mut memory,
&mut heap_cursor,
stack_base,
fragment_size,
false,
);
if fragment_addr == 0
|| memory
.write_bytes(fragment_addr, &library.fragment_bytes)
.is_none()
{
return Err(PpcLoadError::BundledLibraryLoad {
library_name: library.library_name.clone(),
error: PPC_FRAG_NO_MEM,
});
}
let init_block = ppc_create_mem_fragment_init_block(
None,
&mut memory,
&mut heap_cursor,
stack_base,
connection.id,
fragment_addr,
fragment_size,
&library.library_name,
)
.map_err(|error| PpcLoadError::BundledLibraryLoad {
library_name: library.library_name.clone(),
error,
})?;
startup_initializers.push((connection.init_addr, init_block));
}
let library_initializer_count = startup_initializers.len();
let mut application_startup = None;
if let Some((init_addr, init_entry, init_rtoc)) = init_tvector {
let fragment_size = u32::try_from(data.len()).map_err(|_| PpcLoadError::AddressOverflow)?;
let fragment_addr = ppc_heap_alloc(
&mut memory,
&mut heap_cursor,
stack_base,
fragment_size,
false,
);
if fragment_addr == 0 || memory.write_bytes(fragment_addr, data).is_none() {
return Err(PpcLoadError::AddressOverflow);
}
let init_block = ppc_create_mem_fragment_init_block(
None,
&mut memory,
&mut heap_cursor,
stack_base,
next_cfm_connection_id,
fragment_addr,
fragment_size,
application_fragment_name.unwrap_or("application"),
)
.map_err(|_| PpcLoadError::AddressOverflow)?;
application_startup = Some((init_addr, init_entry, init_rtoc, init_block));
}
if application_fragment_name.is_some() || init_tvector.is_some() {
cfm_connections.push(PpcCfmConnection {
id: next_cfm_connection_id,
library_name: application_fragment_name.unwrap_or("application").to_string(),
main_addr: main_tvector,
init_addr: init_tvector.map_or(0, |(addr, _, _)| addr),
term_addr: term_tvector.map_or(0, |(addr, _, _)| addr),
exports: application_exports,
});
next_cfm_connection_id = next_cfm_connection_id
.checked_add(1)
.ok_or(PpcLoadError::AddressOverflow)?;
}
let startup = if library_initializer_count == 0 {
if let Some((_, init_entry, init_rtoc, init_block)) = application_startup {
Some((
init_entry,
init_rtoc,
init_block,
PPC_APPLICATION_INIT_RETURN_PC,
))
} else {
None
}
} else {
if let Some((init_addr, _, _, init_block)) = application_startup {
startup_initializers.push((init_addr, init_block));
}
let bytes = ppc_initializers_trampoline(&startup_initializers, entry_pc, rtoc);
let size = u32::try_from(bytes.len()).map_err(|_| PpcLoadError::AddressOverflow)?;
if size > PPC_APPLICATION_INIT_RETURN_PC - PPC_INITIALIZERS_TRAMPOLINE_BASE
|| memory
.readonly_allocation_overlap_end(PPC_INITIALIZERS_TRAMPOLINE_BASE, size)
.is_some()
|| memory
.publish_system_code(
GuestIsa::PowerPc,
PPC_INITIALIZERS_TRAMPOLINE_BASE,
bytes,
)
.is_none()
{
return Err(PpcLoadError::AddressOverflow);
}
Some((
PPC_INITIALIZERS_TRAMPOLINE_BASE,
rtoc,
0,
PPC_HALT_PC,
))
};
let stack_pointer = PPC_STACK_TOP - PPC_INITIAL_STACK_FRAME_SIZE;
let mut stack = vec![0u8; stack_size as usize];
let sp_offset = usize::try_from(stack_pointer - stack_base).unwrap();
stack[sp_offset..sp_offset + 4].copy_from_slice(&0u32.to_be_bytes());
memory.add_region(stack_base, stack);
let mut cpu = PpcCpu::new();
cpu.alignment_policy = PpcAlignmentPolicy::EmulateData;
cpu.pc = startup.map_or(entry_pc, |startup| startup.0);
cpu.gpr[1] = stack_pointer;
cpu.gpr[2] = startup.map_or(rtoc, |startup| startup.1);
cpu.gpr[3] = startup.map_or(0, |startup| startup.2);
cpu.lr = startup.map_or(PPC_HALT_PC, |startup| startup.3);
let mut toolbox_startup = PpcToolboxStartupState::default();
let mut handles = Vec::new();
let mut screen_clut = TrapDispatcher::standard_mac_8bpp_clut();
let mut color_manager_clut = screen_clut;
let process_memory_manager = PpcProcessMemoryManager::with_heap(heap_cursor, stack_base);
if config.screen_depth != PPC_MAIN_PIXEL_DEPTH {
let saved_r3 = cpu.gpr[3];
let saved_r4 = cpu.gpr[4];
cpu.gpr[3] = PPC_MAIN_GDEVICE;
cpu.gpr[4] = config.screen_depth;
let mut last_mem_error = PPC_NO_ERR;
let shared_memory_manager = process_memory_manager.0.clone();
let mut memory_manager = shared_memory_manager.borrow_mut();
let mut allocator = PpcProcessAllocatorView {
memory_manager: memory_manager.native_mut(),
};
let result = ppc_set_depth(
&cpu,
Some(&mut allocator),
&mut memory,
&mut heap_cursor,
stack_base,
&mut last_mem_error,
&mut handles,
&mut gworlds,
&mut toolbox_startup,
&mut screen_clut,
&mut color_manager_clut,
);
cpu.gpr[3] = saved_r3;
cpu.gpr[4] = saved_r4;
if result != PPC_NO_ERR {
return Err(PpcLoadError::ScreenDepthOutOfRange {
requested: config.screen_depth,
});
}
}
let sound = PpcSoundState::default();
sound
.manager
.set_default_output_volume(PPC_DEFAULT_OUTPUT_VOLUME);
Ok(PpcLoadedApp {
cpu,
memory,
entry_pc,
rtoc,
stack_base,
stack_size,
stack_pointer,
tick_state: SharedProcessTickState::default(),
clock_cycles_per_tick: 1,
clock_cycle_phase: 0,
trap_default_gateways: HashMap::new(),
native_exception_handler: 0,
native_exception_stack: Vec::new(),
stdc_qsort_stack: Vec::new(),
dialog_callback_stack: Vec::new(),
collection_callback_stack: Vec::new(),
pending_file_completions: VecDeque::new(),
apple_events: PpcAppleEventState::default(),
cfm: Some(PpcCfmState {
connections: cfm_connections,
library_fragments,
next_connection_id: next_cfm_connection_id,
}),
controls: SharedProcessControlManager::default(),
aliases: Vec::new(),
gworlds,
gworld_pixel_states,
q3_objects: Vec::new(),
q3_object_refs: Vec::new(),
next_q3_object: PPC_Q3_OBJECT_BASE,
q3_error_state: PpcQ3ErrorState::default(),
q3_lifecycle: PpcQ3LifecycleState::default(),
q3_memory_storages: Vec::new(),
q3_files: Vec::new(),
q3_group_memberships: Vec::new(),
q3_file_groups: Vec::new(),
q3_views: Vec::new(),
q3_submissions: Vec::new(),
q3_view_transforms: Vec::new(),
q3_submission_transforms: Vec::new(),
q3_view_materials: Vec::new(),
q3_submission_materials: Vec::new(),
q3_submission_lights: Vec::new(),
q3_view_state_stack: Vec::new(),
q3_completed_frames: Vec::new(),
q3_retained_frames: Vec::new(),
q3_state_only_completed_frame_batches: Vec::new(),
q3_fog_styles: Vec::new(),
q3_attributes: Vec::new(),
q3_shader_uv_transforms: Vec::new(),
q3_shader_boundaries: Vec::new(),
q3_mipmap_textures: Vec::new(),
q3_texture_shaders: Vec::new(),
q3_renderer_preferences: Vec::new(),
q3_draw_contexts: Vec::new(),
q3_trimeshes: Vec::new(),
q3_styles: Vec::new(),
q3_cameras: Vec::new(),
q3_lights: Vec::new(),
input_sprocket: PpcInputSprocketState::default(),
input_sprocket_virtual_elements: Vec::new(),
toolbox_startup,
quicktime: PpcQuickTimeState::default(),
sound,
timer_tasks: Default::default(),
vbl_tasks: Default::default(),
callback_scheduling: Default::default(),
process_file_system: ppc_initial_process_file_system(),
current_gworld: SharedProcessGraphicsPort::from_value(PPC_MAIN_GWORLD),
current_gdevice: SharedProcessGraphicsDevice::from_value(PPC_MAIN_GDEVICE),
quickdraw_op_colors: SharedProcessQuickDrawOpColors::default(),
quickdraw_hilite_colors: SharedProcessQuickDrawHiliteColors::default(),
screen_clut: SharedProcessDisplayClut::from_value(screen_clut),
color_manager_clut: SharedProcessDisplayClut::from_value(color_manager_clut),
display_gamma: SharedProcessDisplayGamma::default(),
process_quickdraw_port_state_attached: false,
quickdraw_fore_color: PPC_RGB_BLACK,
quickdraw_fore_indices: HashMap::new(),
quickdraw_back_color: PPC_RGB_WHITE,
quickdraw_pen_h: 0,
quickdraw_pen_v: 0,
quickdraw_text_mode: PPC_QD_TEXT_MODE_SRC_OR,
quickdraw_text_size: PPC_QD_TEXT_SIZE_SYSTEM,
cursor_state: SharedProcessCursorState::default(),
param_text: SharedProcessDialogText::default(),
scrap: PpcScrapState::default(),
list_manager: PpcListManagerState::default(),
collections: SharedProcessCollectionManager::default(),
halt_pc: PPC_HALT_PC,
import_trap_base: PPC_IMPORT_TRAP_BASE,
import_count,
imports,
section_bases,
input: PpcInputSnapshot::default(),
process_input: SharedProcessInputState::default(),
event_queue: SharedProcessEventQueue::default(),
window_list: Default::default(),
process_memory_manager,
draw_sprocket: PpcDrawSprocketState::default(),
})
}
fn map_instantiated_sections(data: &[u8]) -> Result<Vec<MappedSection>, PpcLoadError> {
let instantiated = instantiate_pef_sections(data).ok_or(PpcLoadError::SectionInstantiation)?;
let mut mapped = Vec::with_capacity(instantiated.len());
let mut code_cursor = PPC_CODE_BASE;
let mut data_cursor = PPC_DATA_BASE;
for section in instantiated {
let align = alignment_bytes(section.header.alignment)?;
let size = section.bytes.len() as u32;
let base = if section.header.section_kind == SECTION_KIND_CODE {
code_cursor = align_up(code_cursor, align)?;
let base = code_cursor;
code_cursor = code_cursor
.checked_add(size)
.ok_or(PpcLoadError::AddressOverflow)?;
base
} else {
data_cursor = align_up(data_cursor, align)?;
let base = data_cursor;
data_cursor = data_cursor
.checked_add(size)
.ok_or(PpcLoadError::AddressOverflow)?;
base
};
mapped.push(MappedSection {
index: section.index,
section_kind: section.header.section_kind,
base,
bytes: section.bytes,
});
}
Ok(mapped)
}
fn relocation_import_symbol(
imports: &[PpcImportBinding],
symbol_index: u32,
) -> Option<PpcRelocationImportSymbol> {
let import = imports
.iter()
.find(|import| import.symbol_index == symbol_index)?;
Some(PpcRelocationImportSymbol {
symbol_index: import.symbol_index,
library_name: import.library_name.clone(),
symbol_name: import.symbol_name.clone(),
class: import.class,
weak: import.weak,
})
}
fn dispatcher_target_for_import(
library_name: &str,
symbol_name: &str,
) -> PpcImportDispatcherTarget {
let library_name = if library_name == "CarbonLib" {
"InterfaceLib"
} else {
library_name
};
match (library_name, symbol_name) {
("ColMgrLib", "getCollectionMgrLibVersion") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::Version)
}
("ColMgrLib", "NewCollection") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::New)
}
("ColMgrLib", "DisposeCollection") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::Dispose)
}
("ColMgrLib", "CloneCollection") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::Clone)
}
("ColMgrLib", "CountCollectionOwners") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::CountOwners)
}
("ColMgrLib", "CopyCollection") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::Copy)
}
("ColMgrLib", "GetCollectionDefaultAttributes") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetDefaultAttributes)
}
("ColMgrLib", "SetCollectionDefaultAttributes") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::SetDefaultAttributes)
}
("ColMgrLib", "CountCollectionItems") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::CountItems)
}
("ColMgrLib", "AddCollectionItem") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::AddItem)
}
("ColMgrLib", "GetCollectionItem") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetItem)
}
("ColMgrLib", "RemoveCollectionItem") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::RemoveItem)
}
("ColMgrLib", "SetCollectionItemInfo") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::SetItemInfo)
}
("ColMgrLib", "GetCollectionItemInfo") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetItemInfo)
}
("ColMgrLib", "ReplaceIndexedCollectionItem") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::ReplaceIndexedItem)
}
("ColMgrLib", "GetIndexedCollectionItem") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetIndexedItem)
}
("ColMgrLib", "RemoveIndexedCollectionItem") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::RemoveIndexedItem)
}
("ColMgrLib", "SetIndexedCollectionItemInfo") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::SetIndexedItemInfo)
}
("ColMgrLib", "GetIndexedCollectionItemInfo") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetIndexedItemInfo)
}
("ColMgrLib", "CollectionTagExists") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::TagExists)
}
("ColMgrLib", "CountCollectionTags") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::CountTags)
}
("ColMgrLib", "GetIndexedCollectionTag") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetIndexedTag)
}
("ColMgrLib", "CountTaggedCollectionItems") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::CountTaggedItems)
}
("ColMgrLib", "GetTaggedCollectionItem") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetTaggedItem)
}
("ColMgrLib", "GetTaggedCollectionItemInfo") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetTaggedItemInfo)
}
("ColMgrLib", "PurgeCollection") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::Purge)
}
("ColMgrLib", "PurgeCollectionTag") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::PurgeTag)
}
("ColMgrLib", "EmptyCollection") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::Empty)
}
("ColMgrLib", "FlattenCollection") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::Flatten)
}
("ColMgrLib", "FlattenPartialCollection") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::FlattenPartial)
}
("ColMgrLib", "UnflattenCollection") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::Unflatten)
}
("ColMgrLib", "GetCollectionExceptionProc") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetExceptionProc)
}
("ColMgrLib", "SetCollectionExceptionProc") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::SetExceptionProc)
}
("ColMgrLib", "AddCollectionItemHdl") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::AddItemHandle)
}
("ColMgrLib", "GetCollectionItemHdl") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetItemHandle)
}
("ColMgrLib", "ReplaceIndexedCollectionItemHdl") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::ReplaceIndexedItemHandle)
}
("ColMgrLib", "GetIndexedCollectionItemHdl") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::GetIndexedItemHandle)
}
("ColMgrLib", "FlattenCollectionToHdl") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::FlattenToHandle)
}
("ColMgrLib", "UnflattenCollectionFromHdl") => {
PpcImportDispatcherTarget::Collection(PpcCollectionOperation::UnflattenFromHandle)
}
("InterfaceLib" | "ProcessMgrSupport", "InstallExceptionHandler") => {
PpcImportDispatcherTarget::InstallExceptionHandler
}
(library_name, "Q3Initialize") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Initialize
}
(library_name, "Q3Exit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Exit
}
(library_name, "Q3GetVersion") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3GetVersion
}
(library_name, "Q3MemoryStorage_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MemoryStorageNew
}
(library_name, "Q3MemoryStorage_NewBuffer") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MemoryStorageNewBuffer
}
(library_name, "Q3FSSpecStorage_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FSSpecStorageNew
}
(library_name, "Q3File_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FileNew
}
(library_name, "Q3View_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewNew
}
(library_name, "Q3TriMesh_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3TriMeshNew
}
(library_name, "Q3TriMesh_EmptyData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3TriMeshEmptyData
}
(library_name, "Q3AttributeSet_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3AttributeSetNew
}
(library_name, "Q3ViewAngleAspectCamera_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewAngleAspectCameraNew
}
(library_name, "Q3OrthographicCamera_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3OrthographicCameraNew
}
(library_name, "Q3ViewPlaneCamera_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewPlaneCameraNew
}
(library_name, "Q3AmbientLight_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3AmbientLightNew
}
(library_name, "Q3DirectionalLight_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3DirectionalLightNew
}
(library_name, "Q3PointLight_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PointLightNew
}
(library_name, "Q3SpotLight_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightNew
}
(library_name, "Q3LightGroup_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LightGroupNew
}
(library_name, "Q3DisplayGroup_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3DisplayGroupNew
}
(library_name, "Q3OrderedDisplayGroup_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3OrderedDisplayGroupNew
}
(library_name, "Q3BackfacingStyle_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3BackfacingStyleNew
}
(library_name, "Q3InterpolationStyle_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3InterpolationStyleNew
}
(library_name, "Q3FillStyle_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FillStyleNew
}
(library_name, "Q3OrientationStyle_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3OrientationStyleNew
}
(library_name, "Q3MipmapTexture_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MipmapTextureNew
}
(library_name, "Q3TextureShader_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3TextureShaderNew
}
(library_name, "Q3LambertIllumination_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LambertIlluminationNew
}
(library_name, "Q3NULLIllumination_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3NullIlluminationNew
}
(library_name, "Q3PhongIllumination_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PhongIlluminationNew
}
(library_name, "Q3PixmapDrawContext_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PixmapDrawContextNew
}
(library_name, "Q3MacDrawContext_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MacDrawContextNew
}
(library_name, "Q3MatrixTransform_New") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MatrixTransformNew
}
(library_name, symbol_name)
if is_quickdraw_3d_library(library_name)
&& symbol_name.starts_with("Q3")
&& symbol_name.ends_with("_New") =>
{
PpcImportDispatcherTarget::Q3NewObject
}
(library_name, "Q3Renderer_NewFromType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3RendererNewFromType
}
(library_name, "Q3Renderer_GetType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3RendererGetType
}
(library_name, "Q3Renderer_Sync") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3RendererSync
}
(library_name, "Q3Renderer_Flush") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3RendererFlush
}
(library_name, "Q3InteractiveRenderer_SetDoubleBufferBypass")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3InteractiveRendererSetDoubleBufferBypass
}
(library_name, "Q3InteractiveRenderer_SetPreferences")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3InteractiveRendererSetPreferences
}
(library_name, "Q3InteractiveRenderer_SetRAVEContextHints")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3InteractiveRendererSetRaveContextHints
}
(library_name, "Q3InteractiveRenderer_GetRAVEContextHints")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3InteractiveRendererGetRaveContextHints
}
(library_name, "Q3InteractiveRenderer_GetRAVEDrawContexts")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3InteractiveRendererGetRaveDrawContexts
}
(library_name, "Q3InteractiveRenderer_SetRAVETextureFilter")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3InteractiveRendererSetRaveTextureFilter
}
(library_name, "Q3Object_Dispose") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ObjectDispose
}
(library_name, "Q3Object_Duplicate") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ObjectDuplicate
}
(library_name, "Q3Shared_GetReference") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SharedGetReference
}
(library_name, "Q3Shared_IsReferenced") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SharedIsReferenced
}
(library_name, "Q3Shared_GetType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SharedGetType
}
(library_name, "Q3Shape_GetType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ShapeGetType
}
(library_name, "Q3Shape_GetLeafType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ShapeGetLeafType
}
(library_name, "Q3Error_Get") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ErrorGet
}
(library_name, "Q3Object_IsDrawable") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ObjectIsDrawable
}
(library_name, "Q3Object_IsType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ObjectIsType
}
(library_name, "Q3Object_GetType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ObjectGetType
}
(library_name, "Q3Object_GetLeafType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ObjectGetLeafType
}
(library_name, "Q3Light_GetType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LightGetType
}
(library_name, "Q3Geometry_GetType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3GeometryGetType
}
(library_name, "Q3Shader_GetType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ShaderGetType
}
(library_name, "Q3Group_GetType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3GroupGetType
}
(library_name, "Q3Matrix3x3_SetTranslate") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix3x3SetTranslate
}
(library_name, "Q3Matrix4x4_SetIdentity") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix4x4SetIdentity
}
(library_name, "Q3Matrix4x4_SetTranslate") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix4x4SetTranslate
}
(library_name, "Q3Matrix4x4_SetScale") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix4x4SetScale
}
(library_name, "Q3Matrix4x4_SetRotate_X") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix4x4SetRotateX
}
(library_name, "Q3Matrix4x4_SetRotate_Y") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix4x4SetRotateY
}
(library_name, "Q3Matrix4x4_SetRotate_Z") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix4x4SetRotateZ
}
(library_name, "Q3Matrix4x4_SetRotate_XYZ") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix4x4SetRotateXyz
}
(library_name, "Q3Matrix4x4_Multiply") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix4x4Multiply
}
(library_name, "Q3Matrix4x4_Transpose") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix4x4Transpose
}
(library_name, "Q3Matrix4x4_Invert") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Matrix4x4Invert
}
(library_name, "Q3Point3D_Transform") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Point3DTransform
}
(library_name, "Q3Point3D_To3DTransformArray") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Point3DTo3DTransformArray
}
(library_name, "Q3Point3D_To4DTransformArray") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Point3DTo4DTransformArray
}
(library_name, "Q3Vector3D_Transform") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Vector3DTransform
}
(library_name, "Q3MatrixTransform_Set") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MatrixTransformSet
}
(library_name, "Q3Transform_GetMatrix") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3TransformGetMatrix
}
(library_name, "Q3TextureShader_GetTexture") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3TextureShaderGetTexture
}
(library_name, "Q3MipmapTexture_GetMipmap") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MipmapTextureGetMipmap
}
(library_name, "Q3Storage_GetType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3StorageGetType
}
(library_name, "Q3DrawContext_GetPane") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3DrawContextGetPane
}
(library_name, "Q3MemoryStorage_Set") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MemoryStorageSet
}
(library_name, "Q3MemoryStorage_GetBuffer") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MemoryStorageGetBuffer
}
(library_name, "Q3MemoryStorage_SetBuffer") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MemoryStorageSetBuffer
}
(library_name, "Q3MemoryStorage_GetType") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MemoryStorageGetType
}
(library_name, "Q3Camera_GetPlacement") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3CameraGetPlacement
}
(library_name, "Q3Camera_SetPlacement") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3CameraSetPlacement
}
(library_name, "Q3Camera_GetRange") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3CameraGetRange
}
(library_name, "Q3Camera_SetRange") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3CameraSetRange
}
(library_name, "Q3Camera_GetViewPort") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3CameraGetViewPort
}
(library_name, "Q3Camera_SetViewPort") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3CameraSetViewPort
}
(library_name, "Q3Camera_GetWorldToView") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3CameraGetWorldToView
}
(library_name, "Q3Camera_GetViewToFrustum") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3CameraGetViewToFrustum
}
(library_name, "Q3Light_GetState") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LightGetState
}
(library_name, "Q3Light_SetState") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LightSetState
}
(library_name, "Q3Light_GetBrightness") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LightGetBrightness
}
(library_name, "Q3Light_SetBrightness") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LightSetBrightness
}
(library_name, "Q3Light_GetColor") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LightGetColor
}
(library_name, "Q3Light_SetColor") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LightSetColor
}
(library_name, "Q3Light_GetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LightGetData
}
(library_name, "Q3Light_SetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3LightSetData
}
(library_name, "Q3AmbientLight_GetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3AmbientLightGetData
}
(library_name, "Q3AmbientLight_SetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3AmbientLightSetData
}
(library_name, "Q3DirectionalLight_GetCastShadowsState")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3DirectionalLightGetCastShadowsState
}
(library_name, "Q3DirectionalLight_SetCastShadowsState")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3DirectionalLightSetCastShadowsState
}
(library_name, "Q3DirectionalLight_GetDirection")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3DirectionalLightGetDirection
}
(library_name, "Q3DirectionalLight_SetDirection")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3DirectionalLightSetDirection
}
(library_name, "Q3DirectionalLight_GetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3DirectionalLightGetData
}
(library_name, "Q3DirectionalLight_SetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3DirectionalLightSetData
}
(library_name, "Q3PointLight_GetCastShadowsState")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3PointLightGetCastShadowsState
}
(library_name, "Q3PointLight_SetCastShadowsState")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3PointLightSetCastShadowsState
}
(library_name, "Q3PointLight_GetAttenuation") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PointLightGetAttenuation
}
(library_name, "Q3PointLight_SetAttenuation") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PointLightSetAttenuation
}
(library_name, "Q3PointLight_GetLocation") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PointLightGetLocation
}
(library_name, "Q3PointLight_SetLocation") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PointLightSetLocation
}
(library_name, "Q3PointLight_GetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PointLightGetData
}
(library_name, "Q3PointLight_SetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PointLightSetData
}
(library_name, "Q3SpotLight_GetCastShadowsState")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3SpotLightGetCastShadowsState
}
(library_name, "Q3SpotLight_SetCastShadowsState")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3SpotLightSetCastShadowsState
}
(library_name, "Q3SpotLight_GetAttenuation") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightGetAttenuation
}
(library_name, "Q3SpotLight_SetAttenuation") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightSetAttenuation
}
(library_name, "Q3SpotLight_GetLocation") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightGetLocation
}
(library_name, "Q3SpotLight_SetLocation") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightSetLocation
}
(library_name, "Q3SpotLight_GetDirection") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightGetDirection
}
(library_name, "Q3SpotLight_SetDirection") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightSetDirection
}
(library_name, "Q3SpotLight_GetHotAngle") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightGetHotAngle
}
(library_name, "Q3SpotLight_SetHotAngle") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightSetHotAngle
}
(library_name, "Q3SpotLight_GetOuterAngle") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightGetOuterAngle
}
(library_name, "Q3SpotLight_SetOuterAngle") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightSetOuterAngle
}
(library_name, "Q3SpotLight_GetFallOff") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightGetFallOff
}
(library_name, "Q3SpotLight_SetFallOff") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightSetFallOff
}
(library_name, "Q3SpotLight_GetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightGetData
}
(library_name, "Q3SpotLight_SetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3SpotLightSetData
}
(library_name, "Q3Shader_GetUVTransform") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ShaderGetUVTransform
}
(library_name, "Q3Shader_SetUVTransform") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ShaderSetUVTransform
}
(library_name, "Q3Shader_GetUBoundary") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ShaderGetUBoundary
}
(library_name, "Q3Shader_SetUBoundary") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ShaderSetUBoundary
}
(library_name, "Q3Shader_GetVBoundary") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ShaderGetVBoundary
}
(library_name, "Q3Shader_SetVBoundary") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ShaderSetVBoundary
}
(library_name, "Q3BackfacingStyle_Get") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3BackfacingStyleGet
}
(library_name, "Q3BackfacingStyle_Set") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3BackfacingStyleSet
}
(library_name, "Q3InterpolationStyle_Get") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3InterpolationStyleGet
}
(library_name, "Q3InterpolationStyle_Set") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3InterpolationStyleSet
}
(library_name, "Q3FillStyle_Get") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FillStyleGet
}
(library_name, "Q3FillStyle_Set") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FillStyleSet
}
(library_name, "Q3OrientationStyle_Get") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3OrientationStyleGet
}
(library_name, "Q3OrientationStyle_Set") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3OrientationStyleSet
}
(library_name, "Q3TriMesh_GetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3TriMeshGetData
}
(library_name, "Q3TriMesh_SetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3TriMeshSetData
}
(library_name, "Q3AttributeSet_Add") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3AttributeSetAdd
}
(library_name, "Q3AttributeSet_Get") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3AttributeSetGet
}
(library_name, "Q3AttributeSet_Clear") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3AttributeSetClear
}
(library_name, "Q3AttributeSet_Contains") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3AttributeSetContains
}
(library_name, "Q3AttributeSet_GetNextAttributeType")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3AttributeSetGetNextAttributeType
}
(library_name, "Q3Storage_GetSize") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3StorageGetSize
}
(library_name, "Q3Storage_GetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3StorageGetData
}
(library_name, "Q3Storage_SetData") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3StorageSetData
}
(library_name, "Q3Vector3D_Normalize") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Vector3DNormalize
}
(library_name, "Q3Vector3D_Length") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Vector3DLength
}
(library_name, "Q3Vector2D_Normalize") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Vector2DNormalize
}
(library_name, "Q3Vector3D_Cross") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Vector3DCross
}
(library_name, "Q3Point2D_Distance") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Point2DDistance
}
(library_name, "Q3Point3D_Distance") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Point3DDistance
}
(library_name, "Q3Point3D_CrossProductTri") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3Point3DCrossProductTri
}
(library_name, "Q3BoundingBox_SetFromPoints3D") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3BoundingBoxSetFromPoints3D
}
(library_name, "Q3File_SetStorage") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FileSetStorage
}
(library_name, "Q3File_OpenRead") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FileOpenRead
}
(library_name, "Q3File_ReadObject") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FileReadObject
}
(library_name, "Q3File_IsEndOfFile") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FileIsEndOfFile
}
(library_name, "Q3File_Close") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FileClose
}
(library_name, "Q3Group_AddObject") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3GroupAddObject
}
(library_name, "Q3Group_AddObjectBefore") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3GroupAddObjectBefore
}
(library_name, "Q3Group_CountObjects") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3GroupCountObjects
}
(library_name, "Q3Group_GetFirstPosition") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3GroupGetFirstPosition
}
(library_name, "Q3Group_GetNextPosition") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3GroupGetNextPosition
}
(library_name, "Q3Group_GetFirstPositionOfType")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3GroupGetFirstPositionOfType
}
(library_name, "Q3Group_GetPositionObject") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3GroupGetPositionObject
}
(library_name, "Q3Group_RemovePosition") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3GroupRemovePosition
}
(library_name, "Q3View_SetRenderer") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewSetRenderer
}
(library_name, "Q3View_GetRenderer") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewGetRenderer
}
(library_name, "Q3View_SetLightGroup") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewSetLightGroup
}
(library_name, "Q3View_GetLightGroup") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewGetLightGroup
}
(library_name, "Q3View_SetDrawContext") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewSetDrawContext
}
(library_name, "Q3View_GetDrawContext") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewGetDrawContext
}
(library_name, "Q3View_SetCamera") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewSetCamera
}
(library_name, "Q3View_GetCamera") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewGetCamera
}
(library_name, "Q3View_GetWorldToFrustumMatrixState")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3ViewGetWorldToFrustumMatrixState
}
(library_name, "Q3View_GetFrustumToWindowMatrixState")
if is_quickdraw_3d_library(library_name) =>
{
PpcImportDispatcherTarget::Q3ViewGetFrustumToWindowMatrixState
}
(library_name, "Q3View_StartRendering") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewStartRendering
}
(library_name, "Q3View_EndRendering") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewEndRendering
}
(library_name, "Q3View_StartBoundingBox") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewStartBoundingBox
}
(library_name, "Q3View_EndBoundingBox") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewEndBoundingBox
}
(library_name, "Q3View_StartBoundingSphere") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewStartBoundingSphere
}
(library_name, "Q3View_EndBoundingSphere") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewEndBoundingSphere
}
(library_name, "Q3View_Cancel") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ViewCancel
}
(library_name, "Q3Shader_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ShaderSubmit
}
(library_name, "Q3Style_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3StyleSubmit
}
(library_name, "Q3BackfacingStyle_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3BackfacingStyleSubmit
}
(library_name, "Q3InterpolationStyle_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3InterpolationStyleSubmit
}
(library_name, "Q3FillStyle_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FillStyleSubmit
}
(library_name, "Q3OrientationStyle_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3OrientationStyleSubmit
}
(library_name, "Q3FogStyle_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3FogStyleSubmit
}
(library_name, "Q3TriMesh_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3TriMeshSubmit
}
(library_name, "Q3MatrixTransform_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3MatrixTransformSubmit
}
(library_name, "Q3ResetTransform_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ResetTransformSubmit
}
(library_name, "Q3Push_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PushSubmit
}
(library_name, "Q3Pop_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3PopSubmit
}
(library_name, "Q3Object_Submit") if is_quickdraw_3d_library(library_name) => {
PpcImportDispatcherTarget::Q3ObjectSubmit
}
(library_name, symbol_name)
if is_quickdraw_3d_library(library_name)
&& is_quickdraw_3d_status_success_import(symbol_name) =>
{
PpcImportDispatcherTarget::ReturnOne
}
(library_name, "QADeviceGetFirstEngine")
if is_quickdraw_3d_accelerator_library(library_name) =>
{
PpcImportDispatcherTarget::QADeviceGetFirstEngine
}
(library_name, "QADeviceGetNextEngine")
if is_quickdraw_3d_accelerator_library(library_name) =>
{
PpcImportDispatcherTarget::QADeviceGetNextEngine
}
(library_name, "QAEngineGestalt") if is_quickdraw_3d_accelerator_library(library_name) => {
PpcImportDispatcherTarget::QAEngineGestalt
}
("MathLib", "ceil") => PpcImportDispatcherTarget::MathCeil,
("MathLib", "sqrt") => PpcImportDispatcherTarget::MathSqrt,
("MathLib", "exp") => PpcImportDispatcherTarget::MathExp,
("MathLib", "fabs") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::Fabs,
),
("MathLib", "sin") => PpcImportDispatcherTarget::MathSin,
("MathLib", "cos") => PpcImportDispatcherTarget::MathCos,
("MathLib", "asin") => PpcImportDispatcherTarget::MathAsin,
("MathLib", "tan") => PpcImportDispatcherTarget::MathTan,
("MathLib", "atan") => PpcImportDispatcherTarget::MathAtan,
("MathLib", "atan2") => PpcImportDispatcherTarget::MathAtan2,
("MathLib", "pow") => PpcImportDispatcherTarget::MathPow,
("MathLib", "fmod") => PpcImportDispatcherTarget::MathFmod,
("MathLib", "log") => PpcImportDispatcherTarget::MathLog,
("MathLib", "log10") => PpcImportDispatcherTarget::MathLog10,
("MathLib", "nan") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::Nan,
),
("MathLib", "dtox80") => PpcImportDispatcherTarget::MathDtox80,
("Math64Lib", "LongDoubleToSInt64") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::LongDoubleToSInt64)
}
("Math64Lib", "LongDoubleToUInt64") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::LongDoubleToUInt64)
}
("Math64Lib", "S32Set") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S32Set)
}
("Math64Lib", "S64Absolute") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Absolute)
}
("Math64Lib", "S64Add") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Add)
}
("Math64Lib", "S64And") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64And)
}
("Math64Lib", "S64BitwiseAnd") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64BitwiseAnd)
}
("Math64Lib", "S64BitwiseEor") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64BitwiseEor)
}
("Math64Lib", "S64BitwiseNot") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64BitwiseNot)
}
("Math64Lib", "S64BitwiseOr") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64BitwiseOr)
}
("Math64Lib", "S64Compare") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Compare)
}
("Math64Lib", "S64Divide") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Divide)
}
("Math64Lib", "S64Eor") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Eor)
}
("Math64Lib", "S64Max") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Max)
}
("Math64Lib", "S64Min") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Min)
}
("Math64Lib", "S64Multiply") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Multiply)
}
("Math64Lib", "S64Negate") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Negate)
}
("Math64Lib", "S64Not") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Not)
}
("Math64Lib", "S64Or") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Or)
}
("Math64Lib", "S64Set") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Set)
}
("Math64Lib", "S64SetU") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64SetU)
}
("Math64Lib", "S64ShiftLeft") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64ShiftLeft)
}
("Math64Lib", "S64ShiftRight") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64ShiftRight)
}
("Math64Lib", "S64Subtract") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::S64Subtract)
}
("Math64Lib", "SInt64ToLongDouble") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::SInt64ToLongDouble)
}
("Math64Lib", "SInt64ToUInt64") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::SInt64ToUInt64)
}
("Math64Lib", "U32SetU") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U32SetU)
}
("Math64Lib", "U64Add") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64Add)
}
("Math64Lib", "U64And") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64And)
}
("Math64Lib", "U64BitwiseAnd") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64BitwiseAnd)
}
("Math64Lib", "U64BitwiseEor") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64BitwiseEor)
}
("Math64Lib", "U64BitwiseNot") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64BitwiseNot)
}
("Math64Lib", "U64BitwiseOr") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64BitwiseOr)
}
("Math64Lib", "U64Compare") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64Compare)
}
("Math64Lib", "U64Divide") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64Divide)
}
("Math64Lib", "U64Eor") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64Eor)
}
("Math64Lib", "U64Max") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64Max)
}
("Math64Lib", "U64Multiply") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64Multiply)
}
("Math64Lib", "U64Not") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64Not)
}
("Math64Lib", "U64Or") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64Or)
}
("Math64Lib", "U64Set") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64Set)
}
("Math64Lib", "U64SetU") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64SetU)
}
("Math64Lib", "U64ShiftLeft") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64ShiftLeft)
}
("Math64Lib", "U64ShiftRight") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64ShiftRight)
}
("Math64Lib", "U64Subtract") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::U64Subtract)
}
("Math64Lib", "UInt64ToLongDouble") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::UInt64ToLongDouble)
}
("Math64Lib", "UInt64ToSInt64") => {
PpcImportDispatcherTarget::Math64(PpcMath64Operation::UInt64ToSInt64)
}
("MathLib", "pi") => PpcImportDispatcherTarget::NoOpPreserve,
("StdCLib", "__setjmp") => PpcImportDispatcherTarget::ReturnNoErr,
("InterfaceLib", "InitTSMAwareApplication")
| ("InterfaceLib", "CloseTSMAwareApplication") => PpcImportDispatcherTarget::ReturnNoErr,
("InterfaceLib", "SetScriptManagerVariable") => PpcImportDispatcherTarget::ReturnNoErr,
("InterfaceLib", "TSMEvent") | ("InterfaceLib", "TSMMenuSelect") => {
PpcImportDispatcherTarget::ReturnNoErr
}
("InterfaceLib", "KeyScript") => PpcImportDispatcherTarget::NoOpPreserve,
("StdCLib", "atexit") => PpcImportDispatcherTarget::ReturnNoErr,
("StdCLib", "clock") => PpcImportDispatcherTarget::TickCount,
("StdCLib", "memset") => PpcImportDispatcherTarget::StdMemset,
("StdCLib", "memcmp") => PpcImportDispatcherTarget::StdMemcmp,
("StdCLib", "memcpy") => PpcImportDispatcherTarget::StdMemcpy,
("StdCLib", "memmove") => PpcImportDispatcherTarget::StdMemmove,
("StdCLib", "malloc") => PpcImportDispatcherTarget::StdMalloc,
("StdCLib", "free") => PpcImportDispatcherTarget::StdFree,
("StdCLib", "calloc") => PpcImportDispatcherTarget::StdCalloc,
("StdCLib", "realloc") => PpcImportDispatcherTarget::StdRealloc,
("StdCLib", "strcpy") => PpcImportDispatcherTarget::StdStrcpy,
("StdCLib", "strcat") => PpcImportDispatcherTarget::StdStrcat,
("StdCLib", "strncpy") => PpcImportDispatcherTarget::StdStrncpy,
("StdCLib", "strncat") => PpcImportDispatcherTarget::StdStrncat,
("StdCLib", "strcmp") => PpcImportDispatcherTarget::StdStrcmp,
("StdCLib", "strncmp") => PpcImportDispatcherTarget::StdStrncmp,
("StdCLib", "strlen") => PpcImportDispatcherTarget::StdStrlen,
("StdCLib", "memchr") => PpcImportDispatcherTarget::StdMemchr,
("StdCLib", "strchr") => PpcImportDispatcherTarget::StdStrchr,
("StdCLib", "strrchr") => PpcImportDispatcherTarget::StdStrrchr,
("StdCLib", "strspn") => PpcImportDispatcherTarget::StdStrspn,
("StdCLib", "strcspn") => PpcImportDispatcherTarget::StdStrcspn,
("StdCLib", "strpbrk") => PpcImportDispatcherTarget::StdStrpbrk,
("StdCLib", "strstr") => PpcImportDispatcherTarget::StdStrstr,
("StdCLib", "atoi") => PpcImportDispatcherTarget::StdAtoi,
("StdCLib", "getenv") => PpcImportDispatcherTarget::StdGetenv,
("StdCLib", "sprintf") => PpcImportDispatcherTarget::StdSprintf,
("StdCLib", "clearerr") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::ClearErr)
}
("StdCLib", "_filbuf") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FileBuffer)
}
("StdCLib", "fclose") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FileClose)
}
("StdCLib", "feof") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FileEof)
}
("StdCLib", "ferror") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FileError)
}
("StdCLib", "fflush") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FileFlush)
}
("StdCLib", "fopen") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FileOpen)
}
("StdCLib", "fprintf") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FilePrintf)
}
("StdCLib", "fread") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FileRead)
}
("StdCLib", "fseek") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FileSeek)
}
("StdCLib", "ftell") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FileTell)
}
("StdCLib", "fwrite") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::FileWrite)
}
("StdCLib", "_iob") => {
PpcImportDispatcherTarget::StdIoCompatibility(PpcStdIoOperation::IoBuffer)
}
("StdCLib", "abs" | "labs") => PpcImportDispatcherTarget::StdAbs,
("StdCLib", "toupper") => PpcImportDispatcherTarget::StdToupper,
("StdCLib", "tolower") => PpcImportDispatcherTarget::StdTolower,
("StdCLib", "isalnum") => PpcImportDispatcherTarget::StdIsalnum,
("StdCLib", "isalpha") => PpcImportDispatcherTarget::StdIsalpha,
("StdCLib", "isascii") => PpcImportDispatcherTarget::StdIsascii,
("StdCLib", "iscntrl") => PpcImportDispatcherTarget::StdIscntrl,
("StdCLib", "isdigit") => PpcImportDispatcherTarget::StdIsdigit,
("StdCLib", "isgraph") => PpcImportDispatcherTarget::StdIsgraph,
("StdCLib", "islower") => PpcImportDispatcherTarget::StdIslower,
("StdCLib", "isprint") => PpcImportDispatcherTarget::StdIsprint,
("StdCLib", "ispunct") => PpcImportDispatcherTarget::StdIspunct,
("StdCLib", "isspace") => PpcImportDispatcherTarget::StdIsspace,
("StdCLib", "isupper") => PpcImportDispatcherTarget::StdIsupper,
("StdCLib", "isxdigit") => PpcImportDispatcherTarget::StdIsxdigit,
("StdCLib", "toascii") => PpcImportDispatcherTarget::StdToascii,
("StdCLib", "srand") => PpcImportDispatcherTarget::StdSrand,
("StdCLib", "rand") => PpcImportDispatcherTarget::StdRand,
("StdCLib", "time") => PpcImportDispatcherTarget::StdTime,
(
"StdCLib",
"_IntEnv" | "__C_phase" | "__p_CType" | "__target_for_exit" | "_exit_status",
) => PpcImportDispatcherTarget::NoOpPreserve,
("StdCLib", "exit") => PpcImportDispatcherTarget::ExitToShell,
("StdCLib", "_BreakPoint") | ("StdCLib", "__NubAt3") => {
PpcImportDispatcherTarget::NoOpPreserve
}
("InterfaceLib", "AEInstallEventHandler") => {
PpcImportDispatcherTarget::AEInstallEventHandler
}
("DrawSprocketLib", "DSpStartup") => PpcImportDispatcherTarget::DSpStartup,
("DrawSprocketLib", "DSpGetVersion") => PpcImportDispatcherTarget::DSpGetVersion,
("DrawSprocketLib", "DSpShutdown") => PpcImportDispatcherTarget::DSpShutdown,
("DrawSprocketLib", "DSpGetFirstContext") => PpcImportDispatcherTarget::DSpGetFirstContext,
("DrawSprocketLib", "DSpGetNextContext") => PpcImportDispatcherTarget::DSpGetNextContext,
("DrawSprocketLib", "DSpProcessEvent") => PpcImportDispatcherTarget::DSpProcessEvent,
("DrawSprocketLib", "DSpBlit_Fastest") => PpcImportDispatcherTarget::DSpBlitFastest,
("DrawSprocketLib", "DSpCanUserSelectContext") => {
PpcImportDispatcherTarget::DSpCanUserSelectContext
}
("DrawSprocketLib", "DSpGetMouse") => PpcImportDispatcherTarget::DSpGetMouse,
("DrawSprocketLib", "DSpFindContextFromPoint") => {
PpcImportDispatcherTarget::DSpFindContextFromPoint
}
("DrawSprocketLib", "DSpContext_GlobalToLocal") => {
PpcImportDispatcherTarget::DSpContextGlobalToLocal
}
("DrawSprocketLib", "DSpContext_LocalToGlobal") => {
PpcImportDispatcherTarget::DSpContextLocalToGlobal
}
("DrawSprocketLib", "DSpFindBestContext") => PpcImportDispatcherTarget::DSpFindBestContext,
("DrawSprocketLib", "DSpFindBestContextOnDisplayID") => {
PpcImportDispatcherTarget::DSpFindBestContextOnDisplayID
}
("DrawSprocketLib", "DSpUserSelectContext") => {
PpcImportDispatcherTarget::DSpUserSelectContext
}
("DrawSprocketLib", "DSpSetBlankingColor") => {
PpcImportDispatcherTarget::DSpSetBlankingColor
}
("DrawSprocketLib", "DSpAltBuffer_New") => PpcImportDispatcherTarget::DSpAltBufferNew,
("DrawSprocketLib", "DSpAltBuffer_GetCGrafPtr") => {
PpcImportDispatcherTarget::DSpAltBufferGetCGrafPtr
}
("DrawSprocketLib", "DSpContext_Reserve") => PpcImportDispatcherTarget::DSpContextReserve,
("DrawSprocketLib", "DSpContext_Release") => PpcImportDispatcherTarget::DSpContextRelease,
("DrawSprocketLib", "DSpContext_SetState") => PpcImportDispatcherTarget::DSpContextSetState,
("DrawSprocketLib", "DSpContext_GetState") => PpcImportDispatcherTarget::DSpContextGetState,
("DrawSprocketLib", "DSpContext_FadeGamma") => {
PpcImportDispatcherTarget::DSpContextFadeGamma
}
("DrawSprocketLib", "DSpContext_FadeGammaIn") => {
PpcImportDispatcherTarget::DSpContextFadeGammaIn
}
("DrawSprocketLib", "DSpContext_FadeGammaOut") => {
PpcImportDispatcherTarget::DSpContextFadeGammaOut
}
("DrawSprocketLib", "DSpContext_GetFrontBuffer") => {
PpcImportDispatcherTarget::DSpContextGetFrontBuffer
}
("DrawSprocketLib", "DSpContext_GetBackBuffer") => {
PpcImportDispatcherTarget::DSpContextGetBackBuffer
}
("DrawSprocketLib", "DSpContext_SwapBuffers") => {
PpcImportDispatcherTarget::DSpContextSwapBuffers
}
("DrawSprocketLib", "DSpContext_SetCLUTEntries") => {
PpcImportDispatcherTarget::DSpContextSetClutEntries
}
("DrawSprocketLib", "DSpContext_GetDisplayID") => {
PpcImportDispatcherTarget::DSpContextGetDisplayID
}
("DrawSprocketLib", "DSpContext_GetAttributes") => {
PpcImportDispatcherTarget::DSpContextGetAttributes
}
("DrawSprocketLib", "DSpContext_SetVBLProc") => {
PpcImportDispatcherTarget::DSpContextSetVblProc
}
("DrawSprocketLib", "DSpContext_IsBusy") => {
PpcImportDispatcherTarget::DSpContextIsBusy
}
("DrawSprocketLib", "DSpAltBuffer_Dispose") => {
PpcImportDispatcherTarget::DSpAltBufferDispose
}
("DrawSprocketLib", "DSpContext_InvalBackBufferRect") => {
PpcImportDispatcherTarget::DSpContextInvalBackBufferRect
}
("DrawSprocketLib", "DSpContext_SetUnderlayAltBuffer") => {
PpcImportDispatcherTarget::DSpContextSetUnderlayAltBuffer
}
("InputSprocketLib", "ISpElement_NewVirtualFromNeeds") => {
PpcImportDispatcherTarget::ISpElementNewVirtualFromNeeds
}
("InputSprocketLib", "ISpElementList_New") => PpcImportDispatcherTarget::ISpElementListNew,
("InputSprocketLib", "ISpElementList_AddElements") => {
PpcImportDispatcherTarget::ISpElementListAddElements
}
("InputSprocketLib", "ISpElementList_GetNextEvent") => {
PpcImportDispatcherTarget::ISpElementListGetNextEvent
}
("InputSprocketLib", "ISpElementList_Flush") => {
PpcImportDispatcherTarget::ISpElementListFlush
}
("InputSprocketLib", "ISpDevices_Extract") => PpcImportDispatcherTarget::ISpDevicesExtract,
("InputSprocketLib", "ISpDevices_ExtractByClass") => {
PpcImportDispatcherTarget::ISpDevicesExtractByClass
}
("InputSprocketLib", "ISpDevice_GetDefinition") => {
PpcImportDispatcherTarget::ISpDeviceGetDefinition
}
("InputSprocketLib", "ISpDevice_GetElementList") => {
PpcImportDispatcherTarget::ISpDeviceGetElementList
}
("InputSprocketLib", "ISpElementList_Extract") => {
PpcImportDispatcherTarget::ISpElementListExtract
}
("InputSprocketLib", "ISpElement_GetInfo") => PpcImportDispatcherTarget::ISpElementGetInfo,
("InputSprocketLib", "ISpElement_GetSimpleState") => {
PpcImportDispatcherTarget::ISpElementGetSimpleState
}
("InputSprocketLib", "ISpGetVersion") => PpcImportDispatcherTarget::ISpGetVersion,
("InputSprocketLib", "ISpStartup") => PpcImportDispatcherTarget::ISpStartup,
("InputSprocketLib", "ISpShutdown") => PpcImportDispatcherTarget::ISpShutdown,
("InputSprocketLib", "ISpInit") => PpcImportDispatcherTarget::ISpInit,
("InputSprocketLib", "ISpStop") => PpcImportDispatcherTarget::ISpStop,
("InputSprocketLib", "ISpSuspend") => PpcImportDispatcherTarget::ISpSuspend,
("InputSprocketLib", "ISpResume") => PpcImportDispatcherTarget::ISpResume,
("InputSprocketLib", "ISpDevices_Activate") => {
PpcImportDispatcherTarget::ISpDevicesActivate
}
("InputSprocketLib", "ISpDevices_Deactivate") => {
PpcImportDispatcherTarget::ISpDevicesDeactivate
}
("InputSprocketLib", "ISpConfigure") => PpcImportDispatcherTarget::ISpConfigure,
("3DfxGlideLib2.x", "grSstQueryBoards") => PpcImportDispatcherTarget::GlideSstQueryBoards,
("InterfaceLib", "NewPtr") | ("InterfaceLib", "NewPtrSys") => {
PpcImportDispatcherTarget::NewPtr { clear: false }
}
("InterfaceLib", "NewPtrClear") | ("InterfaceLib", "NewPtrSysClear") => {
PpcImportDispatcherTarget::NewPtr { clear: true }
}
("InterfaceLib", "DisposePtr") => PpcImportDispatcherTarget::DisposePtr,
("InterfaceLib", "GetPtrSize") => PpcImportDispatcherTarget::GetPtrSize,
("InterfaceLib", "SetPtrSize") => PpcImportDispatcherTarget::SetPtrSize,
("InterfaceLib", "RecoverHandle") => PpcImportDispatcherTarget::RecoverHandle,
("InterfaceLib", "NewHandle") => PpcImportDispatcherTarget::NewHandle { clear: false },
("InterfaceLib", "NewHandleClear") => PpcImportDispatcherTarget::NewHandle { clear: true },
("InterfaceLib", "TempNewHandle") => PpcImportDispatcherTarget::TempNewHandle,
("InterfaceLib", "TempDisposeHandle") => PpcImportDispatcherTarget::TempDisposeHandle,
("InterfaceLib", "HoldMemory") => PpcImportDispatcherTarget::HoldMemory,
("InterfaceLib", "UnholdMemory") => PpcImportDispatcherTarget::UnholdMemory,
("InterfaceLib", "DisposeHandle") => PpcImportDispatcherTarget::DisposeHandle,
("InterfaceLib", "EmptyHandle") => PpcImportDispatcherTarget::EmptyHandle,
("InterfaceLib", "BlockMove") | ("InterfaceLib", "BlockMoveData") => {
PpcImportDispatcherTarget::BlockMove
}
("InterfaceLib", "BlockZero") => PpcImportDispatcherTarget::BlockZero,
("InterfaceLib", "PtrToHand") => PpcImportDispatcherTarget::PtrToHand,
("InterfaceLib", "PtrToXHand") => PpcImportDispatcherTarget::PtrToXHand,
("InterfaceLib", "HandToHand") => PpcImportDispatcherTarget::HandToHand,
("InterfaceLib", "HandAndHand") => PpcImportDispatcherTarget::HandAndHand,
("InterfaceLib", "GetHandleSize") => PpcImportDispatcherTarget::GetHandleSize,
("InterfaceLib", "SetHandleSize") => PpcImportDispatcherTarget::SetHandleSize,
("InterfaceLib", "HLock") => PpcImportDispatcherTarget::HLock,
("InterfaceLib", "HLockHi") => PpcImportDispatcherTarget::HLockHi,
("InterfaceLib", "HGetState") => PpcImportDispatcherTarget::HGetState,
("InterfaceLib", "HSetState") => PpcImportDispatcherTarget::HSetState,
("InterfaceLib", "HUnlock") => PpcImportDispatcherTarget::HUnlock,
("InterfaceLib", "MoveHHi") => PpcImportDispatcherTarget::MoveHHi,
("InterfaceLib", "HNoPurge") => PpcImportDispatcherTarget::HNoPurge,
("InterfaceLib", "HPurge") => PpcImportDispatcherTarget::HPurge,
("InterfaceLib", "TickCount") => PpcImportDispatcherTarget::TickCount,
("InterfaceLib", "GetZone") => PpcImportDispatcherTarget::GetZone,
("InterfaceLib", "SetZone") => PpcImportDispatcherTarget::SetZone,
("InterfaceLib", "InitZone") => PpcImportDispatcherTarget::InitZone,
("InterfaceLib", "SystemZone") => PpcImportDispatcherTarget::SystemZone,
("InterfaceLib", "ApplicZone") | ("InterfaceLib", "ApplicationZone") => {
PpcImportDispatcherTarget::ApplicationZone
}
("InterfaceLib", "MaxApplZone") => PpcImportDispatcherTarget::MaxApplZone,
("InterfaceLib", "MakeDataExecutable")
| ("InterfaceLib", "FlushCodeCache")
| ("InterfaceLib", "FlushCodeCacheRange")
| ("InterfaceLib", "FlushInstructionCache") => PpcImportDispatcherTarget::FlushCodeCache,
("InterfaceLib", "MoreMasters") => PpcImportDispatcherTarget::MoreMasters,
("InterfaceLib", "GetApplLimit") => PpcImportDispatcherTarget::GetApplLimit,
("InterfaceLib", "SetApplLimit") => PpcImportDispatcherTarget::SetApplLimit,
("InterfaceLib", "CompactMem")
| ("InterfaceLib", "CompactMemSys")
| ("InterfaceLib", "FreeMem")
| ("InterfaceLib", "FreeMemSys") => PpcImportDispatcherTarget::HeapFreeBytes,
("InterfaceLib", "MaxMem") => PpcImportDispatcherTarget::MaxMem,
("InterfaceLib", "MemError") => PpcImportDispatcherTarget::MemError,
("InterfaceLib", "CurResFile") => PpcImportDispatcherTarget::CurResFile,
("InterfaceLib", "UseResFile") => PpcImportDispatcherTarget::UseResFile,
("InterfaceLib", "CloseResFile") => PpcImportDispatcherTarget::CloseResFile,
("InterfaceLib", "OpenResFile") => PpcImportDispatcherTarget::OpenResFile,
("InterfaceLib", "HOpenResFile") => PpcImportDispatcherTarget::HOpenResFile,
("InterfaceLib", "ResError") => PpcImportDispatcherTarget::ResError,
("InterfaceLib", "SetResLoad") => PpcImportDispatcherTarget::SetResLoad,
("InterfaceLib", "LMGetResLoad") => PpcImportDispatcherTarget::LMGetResLoad,
("InterfaceLib", "LoadResource") => PpcImportDispatcherTarget::LoadResource,
("InterfaceLib", "GetIndString") | ("InterfaceLib", "getindstring") => {
PpcImportDispatcherTarget::GetIndString
}
("InterfaceLib", "GetString") => PpcImportDispatcherTarget::GetString,
("InterfaceLib", "GetResource") => PpcImportDispatcherTarget::GetResource,
("InterfaceLib", "Get1Resource") => PpcImportDispatcherTarget::Get1Resource,
("InterfaceLib", "GetNamedResource") => PpcImportDispatcherTarget::GetNamedResource,
("InterfaceLib", "Get1NamedResource") => PpcImportDispatcherTarget::Get1NamedResource,
("InterfaceLib", "GetIndResource") => PpcImportDispatcherTarget::GetIndResource,
("InterfaceLib", "Get1IndResource") => PpcImportDispatcherTarget::Get1IndResource,
("InterfaceLib", "GetResAttrs") => PpcImportDispatcherTarget::GetResAttrs,
("InterfaceLib", "SetResAttrs") => PpcImportDispatcherTarget::SetResAttrs,
("InterfaceLib", "GetResInfo") => PpcImportDispatcherTarget::GetResInfo,
("InterfaceLib", "GetResourceSizeOnDisk")
| ("InterfaceLib", "GetMaxResourceSize")
| ("InterfaceLib", "MaxSizeRsrc")
| ("InterfaceLib", "SizeResource") => PpcImportDispatcherTarget::GetResourceSizeOnDisk,
("InterfaceLib", "SetResInfo") => PpcImportDispatcherTarget::SetResInfo,
("InterfaceLib", "HomeResFile") => PpcImportDispatcherTarget::HomeResFile,
("InterfaceLib", "CountResources") => PpcImportDispatcherTarget::CountResources,
("InterfaceLib", "Count1Resources") => PpcImportDispatcherTarget::Count1Resources,
("InterfaceLib", "CountTypes") => PpcImportDispatcherTarget::CountTypes,
("InterfaceLib", "Count1Types") => PpcImportDispatcherTarget::Count1Types,
("InterfaceLib", "GetIndType") => PpcImportDispatcherTarget::GetIndType,
("InterfaceLib", "Get1IndType") => PpcImportDispatcherTarget::Get1IndType,
("InterfaceLib", "UniqueID") => PpcImportDispatcherTarget::UniqueID,
("InterfaceLib", "Unique1ID") => PpcImportDispatcherTarget::Unique1ID,
("InterfaceLib", "UpdateResFile") => PpcImportDispatcherTarget::UpdateResFile,
("InterfaceLib", "AddResource") => PpcImportDispatcherTarget::AddResource,
("InterfaceLib", "ChangedResource") => PpcImportDispatcherTarget::ChangedResource,
("InterfaceLib", "WriteResource") => PpcImportDispatcherTarget::WriteResource,
("InterfaceLib", "RemoveResource") => PpcImportDispatcherTarget::RemoveResource,
("InterfaceLib", "GetPicture") => PpcImportDispatcherTarget::GetPicture,
("InterfaceLib", "GetIndPattern") => PpcImportDispatcherTarget::GetIndPattern,
("InterfaceLib", "GetPixPat") => PpcImportDispatcherTarget::GetPixPat,
("InterfaceLib", "GetPictInfo") => PpcImportDispatcherTarget::GetPictInfo,
("InterfaceLib", "DrawPicture") => PpcImportDispatcherTarget::DrawPicture,
("InterfaceLib", "KillPicture") => PpcImportDispatcherTarget::KillPicture,
("InterfaceLib", "Gestalt") => PpcImportDispatcherTarget::Gestalt,
("InterfaceLib", "NewGestaltValue") => PpcImportDispatcherTarget::NewGestaltValue,
(
"InterfaceLib" | "CodeFragmentMgr" | "CarbonCore.vlib" | "CFMPriv_CarbonCore",
"GetSharedLibrary",
) => PpcImportDispatcherTarget::GetSharedLibrary,
(
"InterfaceLib" | "CodeFragmentMgr" | "CarbonCore.vlib" | "CFMPriv_CarbonCore",
"FindSymbol",
) => PpcImportDispatcherTarget::FindSymbol,
(
"InterfaceLib" | "CodeFragmentMgr" | "CarbonCore.vlib" | "CFMPriv_CarbonCore",
"CountSymbols",
) => PpcImportDispatcherTarget::CountSymbols,
(
"InterfaceLib" | "CodeFragmentMgr" | "CarbonCore.vlib" | "CFMPriv_CarbonCore",
"GetIndSymbol",
) => PpcImportDispatcherTarget::GetIndSymbol,
(
"InterfaceLib" | "CodeFragmentMgr" | "CarbonCore.vlib" | "CFMPriv_CarbonCore",
"CloseConnection",
) => PpcImportDispatcherTarget::CloseConnection,
("InterfaceLib", "GetMemFragment") => PpcImportDispatcherTarget::GetMemFragment,
("InterfaceLib", "GetDiskFragment") => PpcImportDispatcherTarget::GetDiskFragment,
("InterfaceLib", "InitCursor") => PpcImportDispatcherTarget::InitCursor,
("InterfaceLib", "GetQDGlobalsArrow") => PpcImportDispatcherTarget::GetQDGlobalsArrow,
("InterfaceLib", "HideCursor") => PpcImportDispatcherTarget::HideCursor,
("InterfaceLib", "ShowCursor") => PpcImportDispatcherTarget::ShowCursor,
("InterfaceLib", "ShieldCursor") => PpcImportDispatcherTarget::ShieldCursor,
("InterfaceLib", "CrsrDevNextDevice") => PpcImportDispatcherTarget::CrsrDevNextDevice,
("InterfaceLib", "CrsrDevMoveTo") => PpcImportDispatcherTarget::CrsrDevMoveTo,
("InterfaceLib", "GetCursor") => PpcImportDispatcherTarget::GetCursor,
("InterfaceLib", "SetCursor") => PpcImportDispatcherTarget::SetCursor,
("InterfaceLib", "GetCCursor") => PpcImportDispatcherTarget::GetCCursor,
("InterfaceLib", "GetCIcon") => PpcImportDispatcherTarget::GetCIcon,
("InterfaceLib", "PlotCIcon") => PpcImportDispatcherTarget::PlotCIcon,
("InterfaceLib", "DisposeCIcon") => PpcImportDispatcherTarget::DisposeCIcon,
("InterfaceLib", "SetCCursor") => PpcImportDispatcherTarget::SetCCursor,
("InterfaceLib", "DisposeCCursor") => PpcImportDispatcherTarget::DisposeCCursor,
("InterfaceLib", "SysBeep") => PpcImportDispatcherTarget::SysBeep,
("InterfaceLib", "GetForeColor") => PpcImportDispatcherTarget::GetForeColor,
("InterfaceLib", "GetBackColor") => PpcImportDispatcherTarget::GetBackColor,
("InterfaceLib", "ForeColor") => PpcImportDispatcherTarget::ForeColor,
("InterfaceLib", "BackColor") => PpcImportDispatcherTarget::BackColor,
("InterfaceLib", "RGBForeColor") => PpcImportDispatcherTarget::RGBForeColor,
("InterfaceLib", "RGBBackColor") => PpcImportDispatcherTarget::RGBBackColor,
("InterfaceLib", "OpColor") => PpcImportDispatcherTarget::OpColor,
("InterfaceLib", "HiliteColor") => PpcImportDispatcherTarget::HiliteColor,
("InterfaceLib", "PmForeColor") => PpcImportDispatcherTarget::PmForeColor,
("InterfaceLib", "PmBackColor") => PpcImportDispatcherTarget::PmBackColor,
("InterfaceLib", "Color2Index") => PpcImportDispatcherTarget::Color2Index,
("InterfaceLib", "Index2Color") => PpcImportDispatcherTarget::Index2Color,
("InterfaceLib", "RGB2HSL") => PpcImportDispatcherTarget::RGB2HSL,
("InterfaceLib", "RGB2HSV") => PpcImportDispatcherTarget::RGB2HSV,
("InterfaceLib", "HSV2RGB") => PpcImportDispatcherTarget::HSV2RGB,
("InterfaceLib", "FixRatio") => PpcImportDispatcherTarget::FixRatio,
("InterfaceLib", "FixMul") => PpcImportDispatcherTarget::FixMul,
("InterfaceLib", "FixDiv") => PpcImportDispatcherTarget::FixDiv,
("InterfaceLib", "Long2Fix") => PpcImportDispatcherTarget::Long2Fix,
("InterfaceLib", "Fix2Long") => PpcImportDispatcherTarget::Fix2Long,
("InterfaceLib", "FixRound") => PpcImportDispatcherTarget::FixRound,
("InterfaceLib", "Fix2Frac") => PpcImportDispatcherTarget::Fix2Frac,
("InterfaceLib", "Frac2Fix") => PpcImportDispatcherTarget::Frac2Fix,
("InterfaceLib", "Frac2X") => PpcImportDispatcherTarget::Frac2X,
("InterfaceLib", "X2Frac") => PpcImportDispatcherTarget::X2Frac,
("InterfaceLib", "FracSin") => PpcImportDispatcherTarget::FracSin,
("InterfaceLib", "FracCos") => PpcImportDispatcherTarget::FracCos,
("InterfaceLib", "FracSqrt") => PpcImportDispatcherTarget::FracSqrt,
("InterfaceLib", "FracMul") => PpcImportDispatcherTarget::FracMul,
("InterfaceLib", "FracDiv") => PpcImportDispatcherTarget::FracDiv,
("InterfaceLib", "FixATan2") => PpcImportDispatcherTarget::FixATan2,
("InterfaceLib", "WideAdd") => PpcImportDispatcherTarget::WideAdd,
("InterfaceLib", "WideSubtract") => PpcImportDispatcherTarget::WideSubtract,
("InterfaceLib", "WideNegate") => PpcImportDispatcherTarget::WideNegate,
("InterfaceLib", "WideShift") => PpcImportDispatcherTarget::WideShift,
("InterfaceLib", "WideBitShift") => PpcImportDispatcherTarget::WideBitShift,
("InterfaceLib", "WideMultiply") => PpcImportDispatcherTarget::WideMultiply,
("InterfaceLib", "WideDivide") => PpcImportDispatcherTarget::WideDivide,
("InterfaceLib", "WideWideDivide") => PpcImportDispatcherTarget::WideWideDivide,
("InterfaceLib", "WideSquareRoot") => PpcImportDispatcherTarget::WideSquareRoot,
("InterfaceLib", "WideCompare") => PpcImportDispatcherTarget::WideCompare,
("InterfaceLib", "NewMenu") => PpcImportDispatcherTarget::NewMenu,
("InterfaceLib", "DisposeMenu") => PpcImportDispatcherTarget::DisposeMenu,
("InterfaceLib", "GetMenu") => PpcImportDispatcherTarget::GetMenu,
("InterfaceLib", "GetItemCmd") => PpcImportDispatcherTarget::GetItemCmd,
("InterfaceLib", "SetItemCmd") => PpcImportDispatcherTarget::SetItemCmd,
("InterfaceLib", "GetItemMark") => PpcImportDispatcherTarget::GetItemMark,
("InterfaceLib", "CountMItems") => PpcImportDispatcherTarget::CountMItems,
("InterfaceLib", "GetMenuItemText") => PpcImportDispatcherTarget::GetMenuItemText,
("InterfaceLib", "SetMenuItemText") | ("InterfaceLib", "SetItem") => {
PpcImportDispatcherTarget::SetMenuItemText
}
("InterfaceLib", "DeleteMenuItem") | ("InterfaceLib", "DelMenuItem") => {
PpcImportDispatcherTarget::DeleteMenuItem
}
("InterfaceLib", "CalcMenuSize") => PpcImportDispatcherTarget::CalcMenuSize,
("InterfaceLib", "PopUpMenuSelect") => PpcImportDispatcherTarget::PopUpMenuSelect,
("InterfaceLib", "InsertMenu") => PpcImportDispatcherTarget::InsertMenu,
("InterfaceLib", "DeleteMenu") => PpcImportDispatcherTarget::DeleteMenu,
("InterfaceLib", "AppendMenu") => PpcImportDispatcherTarget::AppendMenu,
("InterfaceLib", "InsertMenuItem") | ("InterfaceLib", "InsMenuItem") => {
PpcImportDispatcherTarget::InsertMenuItem
}
("InterfaceLib", "AppendResMenu") | ("InterfaceLib", "AddResMenu") => {
PpcImportDispatcherTarget::AppendResMenu
}
("InterfaceLib", "InsertResMenu") => PpcImportDispatcherTarget::InsertResMenu,
("InterfaceLib", "EnableItem" | "EnableMenuItem") => {
PpcImportDispatcherTarget::EnableMenuItem
}
("InterfaceLib", "DisableItem" | "DisableMenuItem") => {
PpcImportDispatcherTarget::DisableMenuItem
}
("InterfaceLib", "SetItemMark") => PpcImportDispatcherTarget::SetItemMark,
("InterfaceLib", "CheckItem") => PpcImportDispatcherTarget::CheckItem,
("InterfaceLib", "GetMenuBar") => PpcImportDispatcherTarget::GetMenuBar,
("InterfaceLib", "GetNewMBar") => PpcImportDispatcherTarget::GetNewMBar,
("InterfaceLib", "LMGetMenuList") => PpcImportDispatcherTarget::LMGetMenuList,
("InterfaceLib", "LMSetMenuHook") => PpcImportDispatcherTarget::LMSetMenuHook,
("InterfaceLib", "LMGetMenuFlash") => PpcImportDispatcherTarget::LMGetMenuFlash,
("InterfaceLib", "LMGetPaintWhite") => PpcImportDispatcherTarget::LMGetPaintWhite,
("InterfaceLib", "LMGetSysMap") => PpcImportDispatcherTarget::LMGetSysMap,
("InterfaceLib", "LMGetCurApRefNum") => PpcImportDispatcherTarget::LMGetCurApRefNum,
("InterfaceLib", "GetVCBQHdr") => PpcImportDispatcherTarget::GetVCBQHdr,
("InterfaceLib", "LMGetSysEvtMask") => PpcImportDispatcherTarget::LMGetSysEvtMask,
("InterfaceLib", "LMSetSysEvtMask") => PpcImportDispatcherTarget::LMSetSysEvtMask,
("InterfaceLib", "LMGetDefltStack") => PpcImportDispatcherTarget::LMGetDefltStack,
("InterfaceLib", "LMGetCurStackBase") => PpcImportDispatcherTarget::LMGetCurStackBase,
("InterfaceLib", "LMSetPaintWhite") => PpcImportDispatcherTarget::LMSetPaintWhite,
("InterfaceLib", "LMSetResumeProc") => PpcImportDispatcherTarget::LMSetResumeProc,
("InterfaceLib", "LMSetACount") => PpcImportDispatcherTarget::LMSetACount,
("InterfaceLib", "LMSetANumber") => PpcImportDispatcherTarget::LMSetANumber,
("InterfaceLib", "LMSetDlgFont") => PpcImportDispatcherTarget::LMSetDlgFont,
("InterfaceLib", "LMSetMenuFlash") | ("InterfaceLib", "SetMenuFlash") => {
PpcImportDispatcherTarget::SetMenuFlash
}
("InterfaceLib", "ErrorSound") => PpcImportDispatcherTarget::NoOpPreserve,
("InterfaceLib", "ClearMenuBar") => PpcImportDispatcherTarget::ClearMenuBar,
("InterfaceLib", "SetMenuBar") => PpcImportDispatcherTarget::SetMenuBar,
("InterfaceLib", "GetMenuHandle") => PpcImportDispatcherTarget::GetMenuHandle,
("InterfaceLib", "DrawMenuBar") => PpcImportDispatcherTarget::DrawMenuBar,
("InterfaceLib", "FlashMenuBar") => PpcImportDispatcherTarget::FlashMenuBar,
("InterfaceLib", "HMGetHelpMenuHandle") => PpcImportDispatcherTarget::HMGetHelpMenuHandle,
("InterfaceLib", "HMGetBalloons") => PpcImportDispatcherTarget::HMGetBalloons,
("InterfaceLib", "HiliteMenu") => PpcImportDispatcherTarget::HiliteMenu,
("InterfaceLib", "InvalMenuBar") => PpcImportDispatcherTarget::InvalMenuBar,
("InterfaceLib", "DrawGrowIcon") => PpcImportDispatcherTarget::DrawGrowIcon,
("InterfaceLib", "OpenCPicture") | ("InterfaceLib", "DebugStr") => {
PpcImportDispatcherTarget::MenuNoop
}
("InterfaceLib", "LocalToGlobal") => PpcImportDispatcherTarget::LocalToGlobal,
("InterfaceLib", "GlobalToLocal") => PpcImportDispatcherTarget::GlobalToLocal,
("InterfaceLib", "AddPt") => PpcImportDispatcherTarget::AddPt,
("InterfaceLib", "SubPt") => PpcImportDispatcherTarget::SubPt,
("InterfaceLib", "MenuKey") => PpcImportDispatcherTarget::MenuKey,
("AppearanceLib" | "InterfaceLib", "MenuEvent") => PpcImportDispatcherTarget::MenuEvent,
("InterfaceLib", "MenuChoice") => PpcImportDispatcherTarget::MenuChoice,
("InterfaceLib", "MenuSelect") => PpcImportDispatcherTarget::MenuSelect,
("InterfaceLib", "MoveTo") => PpcImportDispatcherTarget::MoveTo,
("InterfaceLib", "Move") => PpcImportDispatcherTarget::Move,
("InterfaceLib", "LineTo") => PpcImportDispatcherTarget::LineTo,
("InterfaceLib", "Line") => PpcImportDispatcherTarget::Line,
("InterfaceLib", "DrawChar") => PpcImportDispatcherTarget::DrawChar,
("InterfaceLib", "DrawText") => PpcImportDispatcherTarget::DrawText,
("InterfaceLib", "DrawString") => PpcImportDispatcherTarget::DrawString,
("InterfaceLib", "TextFont") => PpcImportDispatcherTarget::TextFont,
("InterfaceLib", "TextFace") => PpcImportDispatcherTarget::TextFace,
("InterfaceLib", "TextMode") => PpcImportDispatcherTarget::TextMode,
("InterfaceLib", "TextSize") => PpcImportDispatcherTarget::TextSize,
("InterfaceLib", "PaintRect") => PpcImportDispatcherTarget::PaintRect,
("InterfaceLib", "EraseRect") => PpcImportDispatcherTarget::EraseRect,
("InterfaceLib", "InvertRect") => PpcImportDispatcherTarget::InvertRect,
("InterfaceLib", "FrameRect") => PpcImportDispatcherTarget::FrameRect,
("InterfaceLib", "FillRect") => PpcImportDispatcherTarget::FillRect,
("InterfaceLib", "FrameOval") => PpcImportDispatcherTarget::FrameOval,
("InterfaceLib", "PaintOval") => PpcImportDispatcherTarget::PaintOval,
("InterfaceLib", "EraseOval") => PpcImportDispatcherTarget::EraseOval,
("InterfaceLib", "PaintArc") => PpcImportDispatcherTarget::PaintArc,
("InterfaceLib", "FrameRgn") => PpcImportDispatcherTarget::FrameRgn,
("InterfaceLib", "PaintRgn") => PpcImportDispatcherTarget::PaintRgn,
("InterfaceLib", "FillRgn") => PpcImportDispatcherTarget::FillRgn,
("InterfaceLib", "InvertRgn") => PpcImportDispatcherTarget::InvertRgn,
("InterfaceLib", "FillCRect") => PpcImportDispatcherTarget::FillCRect,
("InterfaceLib", "FrameRoundRect") => PpcImportDispatcherTarget::FrameRoundRect,
("InterfaceLib", "PaintRoundRect") => PpcImportDispatcherTarget::PaintRoundRect,
("InterfaceLib", "InvalRect") => PpcImportDispatcherTarget::InvalRect,
("InterfaceLib", "ValidRect") => PpcImportDispatcherTarget::ValidRect,
("InterfaceLib", "BeginUpdate") => PpcImportDispatcherTarget::BeginUpdate,
("InterfaceLib", "EndUpdate") => PpcImportDispatcherTarget::EndUpdate,
("InterfaceLib", "ClipRect") => PpcImportDispatcherTarget::ClipRect,
("InterfaceLib", "GetClip") => PpcImportDispatcherTarget::GetClip,
("InterfaceLib", "SetClip") => PpcImportDispatcherTarget::SetClip,
("InterfaceLib", "GetPen") => PpcImportDispatcherTarget::GetPen,
("InterfaceLib", "HidePen") => PpcImportDispatcherTarget::HidePen,
("InterfaceLib", "ShowPen") => PpcImportDispatcherTarget::ShowPen,
("InterfaceLib", "PenSize") => PpcImportDispatcherTarget::PenSize,
("InterfaceLib", "PenMode") => PpcImportDispatcherTarget::PenMode,
("InterfaceLib", "PenNormal") => PpcImportDispatcherTarget::PenNormal,
("InterfaceLib", "PenPixPat") => PpcImportDispatcherTarget::PenPixPat,
("InterfaceLib", "GetPenState") => PpcImportDispatcherTarget::GetPenState,
("InterfaceLib", "SetPenState") => PpcImportDispatcherTarget::SetPenState,
("InterfaceLib", "CopyBits") => PpcImportDispatcherTarget::CopyBits,
("InterfaceLib", "BitMapToRegion") => PpcImportDispatcherTarget::BitMapToRegion,
("InterfaceLib", "NewRgn") => PpcImportDispatcherTarget::NewRgn,
("InterfaceLib", "DisposeRgn") => PpcImportDispatcherTarget::DisposeRgn,
("InterfaceLib", "CopyRgn") => PpcImportDispatcherTarget::CopyRgn,
("InterfaceLib", "OpenRgn") => PpcImportDispatcherTarget::OpenRgn,
("InterfaceLib", "CloseRgn") => PpcImportDispatcherTarget::CloseRgn,
("InterfaceLib", "SectRgn") => PpcImportDispatcherTarget::SectRgn,
("InterfaceLib", "UnionRgn") => PpcImportDispatcherTarget::UnionRgn,
("InterfaceLib", "DiffRgn") => PpcImportDispatcherTarget::DiffRgn,
("InterfaceLib", "XorRgn") => PpcImportDispatcherTarget::XorRgn,
("InterfaceLib", "SetEmptyRgn") => PpcImportDispatcherTarget::SetEmptyRgn,
("InterfaceLib", "SetRectRgn") => PpcImportDispatcherTarget::SetRectRgn,
("InterfaceLib", "RectRgn") => PpcImportDispatcherTarget::RectRgn,
("InterfaceLib", "OffsetRgn") => PpcImportDispatcherTarget::OffsetRgn,
("InterfaceLib", "EmptyRgn") => PpcImportDispatcherTarget::EmptyRgn,
("InterfaceLib", "PtInRgn") => PpcImportDispatcherTarget::PtInRgn,
("InterfaceLib", "RectInRgn") => PpcImportDispatcherTarget::RectInRgn,
("InterfaceLib", "OpenPoly") => PpcImportDispatcherTarget::OpenPoly,
("InterfaceLib", "ClosePoly") => PpcImportDispatcherTarget::ClosePoly,
("InterfaceLib", "KillPoly") => PpcImportDispatcherTarget::KillPoly,
("InterfaceLib", "PaintPoly") => PpcImportDispatcherTarget::PaintPoly,
("InterfaceLib", "FramePoly") => PpcImportDispatcherTarget::FramePoly,
("InterfaceLib", "FillPoly") => PpcImportDispatcherTarget::FillPoly,
("InterfaceLib", "NewCWindow") => PpcImportDispatcherTarget::NewCWindow,
("InterfaceLib", "GetNewCWindow") => PpcImportDispatcherTarget::GetNewCWindow,
("InterfaceLib", "GetWRefCon") => PpcImportDispatcherTarget::GetWRefCon,
("InterfaceLib", "SetWRefCon") => PpcImportDispatcherTarget::SetWRefCon,
("InterfaceLib", "SizeWindow") => PpcImportDispatcherTarget::SizeWindow,
("InterfaceLib", "MoveWindow") => PpcImportDispatcherTarget::MoveWindow,
("InterfaceLib", "ShowWindow") => PpcImportDispatcherTarget::ShowWindow,
("InterfaceLib", "HideWindow") => PpcImportDispatcherTarget::HideWindow,
("InterfaceLib", "ShowHide") => PpcImportDispatcherTarget::ShowHide,
("InterfaceLib", "CloseWindow") => PpcImportDispatcherTarget::CloseWindow,
("InterfaceLib", "SelectWindow") => PpcImportDispatcherTarget::SelectWindow,
("InterfaceLib", "FrontWindow") => PpcImportDispatcherTarget::FrontWindow,
("InterfaceLib", "SetWinColor") => PpcImportDispatcherTarget::SetWinColor,
("InterfaceLib", "PaintOne") => PpcImportDispatcherTarget::PaintOne,
("InterfaceLib", "PaintBehind") => PpcImportDispatcherTarget::PaintBehind,
("InterfaceLib", "CalcVisBehind") => PpcImportDispatcherTarget::CalcVisBehind,
("InterfaceLib", "GetMouse") => PpcImportDispatcherTarget::GetMouse,
("InterfaceLib", "ActivatePalette") => PpcImportDispatcherTarget::ActivatePalette,
("InterfaceLib", "SetPalette") | ("InterfaceLib", "NSetPalette") => {
PpcImportDispatcherTarget::NSetPalette
}
("InterfaceLib", "GetPalette") => PpcImportDispatcherTarget::GetPalette,
("InterfaceLib", "GetPort") => PpcImportDispatcherTarget::GetPort,
("InterfaceLib", "GetWMgrPort") | ("InterfaceLib", "GetCWMgrPort") => {
PpcImportDispatcherTarget::GetWMgrPort
}
("InterfaceLib", "SetPort") => PpcImportDispatcherTarget::SetPort,
("InterfaceLib", "GetGDevice") => PpcImportDispatcherTarget::GetGDevice,
("InterfaceLib", "SetGDevice") => PpcImportDispatcherTarget::SetGDevice,
("InterfaceLib", "GetDeviceList") => PpcImportDispatcherTarget::GetDeviceList,
("InterfaceLib", "GetNextDevice") => PpcImportDispatcherTarget::GetNextDevice,
("InterfaceLib", "GetMainDevice") => PpcImportDispatcherTarget::GetMainDevice,
("InterfaceLib", "GetMaxDevice") => PpcImportDispatcherTarget::GetMaxDevice,
("InterfaceLib", "GetSysFont") => PpcImportDispatcherTarget::GetSysFont,
("InterfaceLib", "GetAppFont") => PpcImportDispatcherTarget::GetAppFont,
("InterfaceLib", "GetDefFontSize") => PpcImportDispatcherTarget::GetDefFontSize,
("InterfaceLib", "GetFontName") => PpcImportDispatcherTarget::GetFontName,
("InterfaceLib", "GetMBarHeight") | ("InterfaceLib", "LMGetMBarHeight") => {
PpcImportDispatcherTarget::GetMBarHeight
}
("InterfaceLib", "LMSetMBarHeight") => PpcImportDispatcherTarget::SetMBarHeight,
("InterfaceLib", "TestDeviceAttribute") => PpcImportDispatcherTarget::TestDeviceAttribute,
("InterfaceLib", "SetDeviceAttribute") => PpcImportDispatcherTarget::SetDeviceAttribute,
("InterfaceLib", "HasDepth") => PpcImportDispatcherTarget::HasDepth,
("InterfaceLib", "SetDepth") => PpcImportDispatcherTarget::SetDepth,
("InterfaceLib", "DMGetDisplayIDByGDevice") => {
PpcImportDispatcherTarget::DMGetDisplayIDByGDevice
}
("DisplayLib", "DMGetNameByAVID") => PpcImportDispatcherTarget::DMGetNameByAVID,
("InterfaceLib", "DMGetGDeviceByDisplayID") => {
PpcImportDispatcherTarget::DMGetGDeviceByDisplayID
}
("InterfaceLib" | "DisplayLib", "DMGetFirstScreenDevice") => {
PpcImportDispatcherTarget::DMGetFirstScreenDevice
}
("InterfaceLib" | "DisplayLib", "DMGetNextScreenDevice") => {
PpcImportDispatcherTarget::DMGetNextScreenDevice
}
("InterfaceLib" | "DisplayLib", "DMGetDisplayMode") => {
PpcImportDispatcherTarget::DMGetDisplayMode
}
("InterfaceLib" | "DisplayLib", "DMCheckDisplayMode") => {
PpcImportDispatcherTarget::DMCheckDisplayMode
}
("InterfaceLib" | "DisplayLib", "DMSetDisplayMode") => {
PpcImportDispatcherTarget::DMSetDisplayMode
}
("InterfaceLib" | "DisplayLib", "DMNewDisplayModeList") => {
PpcImportDispatcherTarget::DMNewDisplayModeList
}
("InterfaceLib" | "DisplayLib", "DMGetIndexedDisplayModeFromList") => {
PpcImportDispatcherTarget::DMGetIndexedDisplayModeFromList
}
("InterfaceLib" | "DisplayLib", "DMDisposeList") => {
PpcImportDispatcherTarget::DMDisposeList
}
("InterfaceLib" | "DisplayLib", "DMBeginConfigureDisplays") => {
PpcImportDispatcherTarget::DMBeginConfigureDisplays
}
("InterfaceLib" | "DisplayLib", "DMEndConfigureDisplays") => {
PpcImportDispatcherTarget::DMEndConfigureDisplays
}
("InterfaceLib" | "DisplayLib", "DMResumeConfigure")
| ("InterfaceLib" | "DisplayLib", "DMSuspendConfigure")
| ("InterfaceLib" | "DisplayLib", "DMUseScreenPrefs") => {
PpcImportDispatcherTarget::ReturnNoErr
}
("InterfaceLib", "NewGWorld") => PpcImportDispatcherTarget::NewGWorld,
("InterfaceLib", "UpdateGWorld") => PpcImportDispatcherTarget::UpdateGWorld,
("InterfaceLib", "DisposeGWorld") => PpcImportDispatcherTarget::DisposeGWorld,
("InterfaceLib", "GetCTable") => PpcImportDispatcherTarget::GetCTable,
("InterfaceLib", "GetCTSeed") => PpcImportDispatcherTarget::GetCTSeed,
("InterfaceLib", "MakeITable") => PpcImportDispatcherTarget::MakeITable,
("InterfaceLib", "QDError") => PpcImportDispatcherTarget::QDError,
("InterfaceLib", "CTabChanged") => PpcImportDispatcherTarget::CTabChanged,
("InterfaceLib", "ProtectEntry") => PpcImportDispatcherTarget::ProtectEntry,
("InterfaceLib", "ReserveEntry") => PpcImportDispatcherTarget::ReserveEntry,
("InterfaceLib", "RestoreEntries") => PpcImportDispatcherTarget::RestoreEntries,
("InterfaceLib", "SetEntries") => PpcImportDispatcherTarget::SetEntries,
("InterfaceLib", "RestoreDeviceClut") => PpcImportDispatcherTarget::RestoreDeviceClut,
("InterfaceLib", "DisposeCTable") => PpcImportDispatcherTarget::DisposeCTable,
("InterfaceLib", "NewPixMap") => PpcImportDispatcherTarget::NewPixMap,
("InterfaceLib", "DisposePixMap") | ("InterfaceLib", "DisposPixMap") => {
PpcImportDispatcherTarget::DisposePixMap
}
("InterfaceLib", "GetGWorld") => PpcImportDispatcherTarget::GetGWorld,
("InterfaceLib", "SetGWorld") => PpcImportDispatcherTarget::SetGWorld,
("InterfaceLib", "GetWindowPort") => PpcImportDispatcherTarget::GetWindowPort,
("InterfaceLib", "SetPortWindowPort") => PpcImportDispatcherTarget::SetPortWindowPort,
("InterfaceLib", "GetGWorldDevice") => PpcImportDispatcherTarget::GetGWorldDevice,
("InterfaceLib", "GetGWorldPixMap") => PpcImportDispatcherTarget::GetGWorldPixMap,
("InterfaceLib", "OpenPort") => PpcImportDispatcherTarget::OpenPort,
("InterfaceLib", "OpenCPort") => PpcImportDispatcherTarget::OpenCPort,
("InterfaceLib", "ClosePort") | ("InterfaceLib", "CloseCPort") => {
PpcImportDispatcherTarget::CloseCPort
}
("InterfaceLib", "SetPortBits") => PpcImportDispatcherTarget::SetPortBits { color: false },
("InterfaceLib", "SetPortPix") => PpcImportDispatcherTarget::SetPortBits { color: true },
("InterfaceLib", "GetPixBaseAddr") => PpcImportDispatcherTarget::GetPixBaseAddr,
("InterfaceLib", "GetPixRowBytes") => PpcImportDispatcherTarget::GetPixRowBytes,
("InterfaceLib", "LockPixels") => PpcImportDispatcherTarget::LockPixels,
("InterfaceLib", "UnlockPixels") => PpcImportDispatcherTarget::UnlockPixels,
("InterfaceLib", "GetPixelsState") => PpcImportDispatcherTarget::GetPixelsState,
("InterfaceLib", "SetPixelsState") => PpcImportDispatcherTarget::SetPixelsState,
("InterfaceLib", "AllowPurgePixels") => PpcImportDispatcherTarget::AllowPurgePixels,
("InterfaceLib", "NoPurgePixels") => PpcImportDispatcherTarget::NoPurgePixels,
("InterfaceLib", "SetRect") => PpcImportDispatcherTarget::SetRect,
("InterfaceLib", "SectRect") => PpcImportDispatcherTarget::SectRect,
("InterfaceLib", "UnionRect") => PpcImportDispatcherTarget::UnionRect,
("InterfaceLib", "EqualRect") => PpcImportDispatcherTarget::EqualRect,
("InterfaceLib", "EmptyRect") => PpcImportDispatcherTarget::EmptyRect,
("InterfaceLib", "SetPt") => PpcImportDispatcherTarget::SetPt,
("InterfaceLib", "EqualPt") => PpcImportDispatcherTarget::EqualPt,
("InterfaceLib", "PtInRect") => PpcImportDispatcherTarget::PtInRect,
("InterfaceLib", "SetOrigin") => PpcImportDispatcherTarget::SetOrigin,
("InterfaceLib", "OffsetRect") => PpcImportDispatcherTarget::OffsetRect,
("InterfaceLib", "MapRect") => PpcImportDispatcherTarget::MapRect,
("InterfaceLib", "InsetRect") => PpcImportDispatcherTarget::InsetRect,
("InterfaceLib", "FindWindow") => PpcImportDispatcherTarget::FindWindow,
("InterfaceLib", "GetGrayRgn") | ("InterfaceLib", "LMGetGrayRgn") => {
PpcImportDispatcherTarget::GetGrayRgn
}
("InterfaceLib", "LMSetGrayRgn") => PpcImportDispatcherTarget::LMSetGrayRgn,
("InterfaceLib", "GetDCtlEntry") => PpcImportDispatcherTarget::GetDCtlEntry,
("InterfaceLib", "GetADBInfo") => PpcImportDispatcherTarget::GetADBInfo,
("InterfaceLib", "OpenDriver") => PpcImportDispatcherTarget::OpenDriver,
("InterfaceLib", "Control") => PpcImportDispatcherTarget::Control,
("InterfaceLib", "PBControl")
| ("InterfaceLib", "PBControlSync")
| ("InterfaceLib", "PBControlAsync") => PpcImportDispatcherTarget::PBControl,
("InterfaceLib", "PBStatus")
| ("InterfaceLib", "PBStatusSync")
| ("InterfaceLib", "PBStatusAsync") => PpcImportDispatcherTarget::PBStatus,
("InterfaceLib", "FindFolder") => PpcImportDispatcherTarget::FindFolder,
("InterfaceLib", "NewAlias") => PpcImportDispatcherTarget::NewAlias,
("InterfaceLib", "NewAliasMinimalFromFullPath") => {
PpcImportDispatcherTarget::NewAliasMinimalFromFullPath
}
("InterfaceLib", "UpdateAlias") => PpcImportDispatcherTarget::UpdateAlias,
("InterfaceLib", "ResolveAlias") => PpcImportDispatcherTarget::ResolveAlias,
("InterfaceLib", "ResolveAliasFile") => PpcImportDispatcherTarget::ResolveAliasFile,
("InterfaceLib", "ResolveAliasFileWithMountFlags") => {
PpcImportDispatcherTarget::ResolveAliasFileWithMountFlags
}
("InterfaceLib", "GetIconRefFromFile") => PpcImportDispatcherTarget::GetIconRefFromFile,
("InterfaceLib", "GetIconRef") => PpcImportDispatcherTarget::GetIconRef,
("InterfaceLib", "PlotIconRef") => PpcImportDispatcherTarget::PlotIconRef,
("InterfaceLib", "ReleaseIconRef") => PpcImportDispatcherTarget::ReleaseIconRef,
("InterfaceLib", "DirCreate") => PpcImportDispatcherTarget::DirCreate,
("InterfaceLib", "FSpDirCreate") => PpcImportDispatcherTarget::FSpDirCreate,
("InterfaceLib", "FSMakeFSSpec") => PpcImportDispatcherTarget::FSMakeFSSpec,
("InterfaceLib", "PBGetFInfo")
| ("InterfaceLib", "PBGetFInfoSync")
| ("InterfaceLib", "PBGetFInfoAsync") => PpcImportDispatcherTarget::PBGetFInfo,
("InterfaceLib", "PBHGetFInfo")
| ("InterfaceLib", "PBHGetFInfoSync")
| ("InterfaceLib", "PBHGetFInfoAsync") => PpcImportDispatcherTarget::PBHGetFInfo,
("InterfaceLib", "PBSetFInfo")
| ("InterfaceLib", "PBSetFInfoSync")
| ("InterfaceLib", "PBSetFInfoAsync") => PpcImportDispatcherTarget::PBSetFInfo,
("InterfaceLib", "PBHSetFInfo")
| ("InterfaceLib", "PBHSetFInfoSync")
| ("InterfaceLib", "PBHSetFInfoAsync") => PpcImportDispatcherTarget::PBHSetFInfo,
("InterfaceLib", "PBGetCatInfo")
| ("InterfaceLib", "PBGetCatInfoSync")
| ("InterfaceLib", "PBGetCatInfoAsync") => PpcImportDispatcherTarget::PBGetCatInfo,
("InterfaceLib", "PBSetCatInfo")
| ("InterfaceLib", "PBSetCatInfoSync")
| ("InterfaceLib", "PBSetCatInfoAsync") => PpcImportDispatcherTarget::PBSetCatInfo,
("InterfaceLib", "PBGetVInfo")
| ("InterfaceLib", "PBGetVInfoSync")
| ("InterfaceLib", "PBGetVInfoAsync")
| ("InterfaceLib", "PBHGetVInfo")
| ("InterfaceLib", "PBHGetVInfoSync")
| ("InterfaceLib", "PBHGetVInfoAsync") => PpcImportDispatcherTarget::PBHGetVInfo,
("InterfaceLib", "GetVInfo") => PpcImportDispatcherTarget::GetVInfo,
("InterfaceLib", "PBDTGetPath") => PpcImportDispatcherTarget::PBDTGetPath,
("InterfaceLib", "PBDTGetCommentSync") => PpcImportDispatcherTarget::PBDTGetCommentSync,
("InterfaceLib", "PBGetFCBInfo")
| ("InterfaceLib", "PBGetFCBInfoSync")
| ("InterfaceLib", "PBGetFCBInfoAsync") => PpcImportDispatcherTarget::PBGetFCBInfo,
("InterfaceLib", "FSpGetFInfo") => PpcImportDispatcherTarget::FSpGetFInfo,
("InterfaceLib", "GetFInfo") | ("InterfaceLib", "getfinfo") => {
PpcImportDispatcherTarget::GetFInfo
}
("InterfaceLib", "HGetFInfo") => PpcImportDispatcherTarget::HGetFInfo,
("InterfaceLib", "FSpSetFInfo") => PpcImportDispatcherTarget::FSpSetFInfo,
("InterfaceLib", "HSetFInfo") => PpcImportDispatcherTarget::HSetFInfo,
("InterfaceLib", "StandardGetFile") => PpcImportDispatcherTarget::StandardGetFile,
("InterfaceLib", "GetScrap") => PpcImportDispatcherTarget::GetScrap,
("InterfaceLib", "PutScrap") => PpcImportDispatcherTarget::PutScrap,
("InterfaceLib", "ZeroScrap") => PpcImportDispatcherTarget::ZeroScrap,
("InterfaceLib", "LoadScrap") => PpcImportDispatcherTarget::LoadScrap,
("InterfaceLib", "UnloadScrap") => {
PpcImportDispatcherTarget::UnloadScrap
}
("InterfaceLib", "FSpOpenDF") => PpcImportDispatcherTarget::FSpOpenDF,
("InterfaceLib", "FSpOpenRF") => PpcImportDispatcherTarget::FSpOpenRF,
("InterfaceLib", "HOpen") | ("InterfaceLib", "HOpenDF") => PpcImportDispatcherTarget::HOpen,
("InterfaceLib", "FSOpen") => PpcImportDispatcherTarget::FSOpen,
("InterfaceLib", "PBOpen")
| ("InterfaceLib", "PBOpenSync")
| ("InterfaceLib", "PBOpenAsync") => PpcImportDispatcherTarget::PBOpen,
("InterfaceLib", "PBHOpenDF")
| ("InterfaceLib", "PBHOpenDFSync")
| ("InterfaceLib", "PBHOpenDFAsync")
| ("InterfaceLib", "PBHOpen")
| ("InterfaceLib", "PBHOpenSync")
| ("InterfaceLib", "PBHOpenAsync") => PpcImportDispatcherTarget::PBHOpenDF,
("InterfaceLib", "FSpCreateResFile") => PpcImportDispatcherTarget::FSpCreateResFile,
("InterfaceLib", "HCreateResFile") => PpcImportDispatcherTarget::HCreateResFile,
("InterfaceLib", "FSpOpenResFile") => PpcImportDispatcherTarget::FSpOpenResFile,
("InterfaceLib", "FSClose") => PpcImportDispatcherTarget::FSClose,
("InterfaceLib", "PBClose")
| ("InterfaceLib", "PBCloseSync")
| ("InterfaceLib", "PBCloseAsync") => PpcImportDispatcherTarget::PBClose,
("InterfaceLib", "PBFlushFile")
| ("InterfaceLib", "PBFlushFileSync")
| ("InterfaceLib", "PBFlushFileAsync") => PpcImportDispatcherTarget::PBFlushFile,
("InterfaceLib", "FSRead") => PpcImportDispatcherTarget::FSRead,
("InterfaceLib", "PBRead")
| ("InterfaceLib", "PBReadSync")
| ("InterfaceLib", "PBReadAsync") => PpcImportDispatcherTarget::PBRead,
("InterfaceLib", "FSWrite") => PpcImportDispatcherTarget::FSWrite,
("InterfaceLib", "PBWrite")
| ("InterfaceLib", "PBWriteSync")
| ("InterfaceLib", "PBWriteAsync") => PpcImportDispatcherTarget::PBWrite,
("InterfaceLib", "GetEOF") => PpcImportDispatcherTarget::GetEOF,
("InterfaceLib", "PBGetEOF")
| ("InterfaceLib", "PBGetEOFSync")
| ("InterfaceLib", "PBGetEOFAsync") => PpcImportDispatcherTarget::PBGetEOF,
("InterfaceLib", "SetEOF") => PpcImportDispatcherTarget::SetEOF,
("InterfaceLib", "AllocContig") | ("InterfaceLib", "Allocate") => {
PpcImportDispatcherTarget::AllocContig
}
("InterfaceLib", "PBSetEOF")
| ("InterfaceLib", "PBSetEOFSync")
| ("InterfaceLib", "PBSetEOFAsync") => PpcImportDispatcherTarget::PBSetEOF,
("InterfaceLib", "GetFPos") => PpcImportDispatcherTarget::GetFPos,
("InterfaceLib", "SetFPos") => PpcImportDispatcherTarget::SetFPos,
("InterfaceLib", "PBSetFPos")
| ("InterfaceLib", "PBSetFPosSync")
| ("InterfaceLib", "PBSetFPosAsync") => PpcImportDispatcherTarget::PBSetFPos,
("InterfaceLib", "FSpCreate") => PpcImportDispatcherTarget::FSpCreate,
("InterfaceLib", "PBHCreate" | "PBHCreateSync" | "PBHCreateAsync") => {
PpcImportDispatcherTarget::PBCreate(PpcParameterBlockCreateOperation::Hierarchical)
}
("InterfaceLib", "PBCreate")
| ("InterfaceLib", "PBCreateSync")
| ("InterfaceLib", "PBCreateAsync") => {
PpcImportDispatcherTarget::PBCreate(PpcParameterBlockCreateOperation::Legacy)
}
("InterfaceLib", "FSpDelete") => PpcImportDispatcherTarget::FSpDelete,
("InterfaceLib", "HDelete") => PpcImportDispatcherTarget::DeleteByName(
PpcDeleteByNameOperation::HierarchicalHighLevel,
),
("InterfaceLib", "FSDelete") => PpcImportDispatcherTarget::DeleteByName(
PpcDeleteByNameOperation::LegacyHighLevel,
),
("InterfaceLib", "PBDelete")
| ("InterfaceLib", "PBDeleteSync")
| ("InterfaceLib", "PBDeleteAsync") => PpcImportDispatcherTarget::DeleteByName(
PpcDeleteByNameOperation::LegacyParameterBlock,
),
("InterfaceLib", "PBHDelete" | "PBHDeleteSync" | "PBHDeleteAsync") => {
PpcImportDispatcherTarget::DeleteByName(
PpcDeleteByNameOperation::HierarchicalParameterBlock,
)
}
("InterfaceLib", "HCreate") => PpcImportDispatcherTarget::HCreate,
("InterfaceLib", "HRename") => PpcImportDispatcherTarget::HRename,
("InterfaceLib", "Create") => PpcImportDispatcherTarget::Create,
("InterfaceLib", "GetNewDialog") => PpcImportDispatcherTarget::GetNewDialog,
("InterfaceLib", "NewDialog")
| ("InterfaceLib", "NewColorDialog")
| ("InterfaceLib", "NewCDialog") => PpcImportDispatcherTarget::NewDialog,
("InterfaceLib" | "AppearanceLib", "RegisterAppearanceClient") => {
PpcImportDispatcherTarget::RegisterAppearanceClient
}
("InterfaceLib" | "AppearanceLib", "UnregisterAppearanceClient") => {
PpcImportDispatcherTarget::UnregisterAppearanceClient
}
("AppearanceLib", "ActivateControl") => PpcImportDispatcherTarget::ActivateControl,
("AppearanceLib", "DeactivateControl") => PpcImportDispatcherTarget::DeactivateControl,
("AppearanceLib", "IsControlActive") => PpcImportDispatcherTarget::IsControlActive,
("AppearanceLib", "CollapseWindow") => PpcImportDispatcherTarget::CollapseWindow,
("AppearanceLib", "IsWindowCollapsed") => PpcImportDispatcherTarget::IsWindowCollapsed,
("AppearanceLib", "SetControlFontStyle") => {
PpcImportDispatcherTarget::SetControlFontStyle
}
("AppearanceLib", "NewFeaturesDialog") | ("InterfaceLib", "NewFeaturesDialog") => {
PpcImportDispatcherTarget::NewFeaturesDialog
}
("InterfaceLib", "GetDialogItem") => PpcImportDispatcherTarget::GetDialogItem,
("AppearanceLib", "GetDialogItemAsControl") => {
PpcImportDispatcherTarget::GetDialogItemAsControl
}
("InterfaceLib", "SetDialogItem") | ("InterfaceLib", "SetDItem") => {
PpcImportDispatcherTarget::SetDialogItem
}
("InterfaceLib", "GetDialogItemText") | ("InterfaceLib", "getdialogitemtext") => {
PpcImportDispatcherTarget::GetDialogItemText
}
("InterfaceLib", "SetDialogItemText") | ("InterfaceLib", "setdialogitemtext") => {
PpcImportDispatcherTarget::SetDialogItemText
}
("InterfaceLib", "SetDialogDefaultItem") => PpcImportDispatcherTarget::SetDialogDefaultItem,
("InterfaceLib" | "AppearanceLib", "SetDialogCancelItem") => {
PpcImportDispatcherTarget::SetDialogCancelItem
}
("InterfaceLib" | "AppearanceLib", "SetDialogTracksCursor") => {
PpcImportDispatcherTarget::SetDialogTracksCursor
}
("InterfaceLib", "StdFilterProc") => PpcImportDispatcherTarget::StdFilterProc,
("InterfaceLib", "DrawDialog") => PpcImportDispatcherTarget::DrawDialog,
("InterfaceLib", "DrawControls") => PpcImportDispatcherTarget::DrawControls,
("InterfaceLib", "ModalDialog") => PpcImportDispatcherTarget::ModalDialog,
("InterfaceLib", "SetControlTitle") | ("InterfaceLib", "SetCTitle") => {
PpcImportDispatcherTarget::SetControlTitle
}
("InterfaceLib", "SetControlValue") => PpcImportDispatcherTarget::SetControlValue,
("InterfaceLib", "HiliteControl") => PpcImportDispatcherTarget::HiliteControl,
("InterfaceLib", "InitGraf") => PpcImportDispatcherTarget::InitGraf,
("InterfaceLib", "InitFonts") => PpcImportDispatcherTarget::InitFonts,
("InterfaceLib", "InitWindows") => PpcImportDispatcherTarget::InitWindows,
("InterfaceLib", "InitMenus") => PpcImportDispatcherTarget::InitMenus,
("InterfaceLib", "TEInit") => PpcImportDispatcherTarget::TEInit,
("InterfaceLib", "TENew") => PpcImportDispatcherTarget::TENew,
("InterfaceLib", "TEStyleNew") => PpcImportDispatcherTarget::TEStyleNew,
("InterfaceLib", "TESetStyle") => PpcImportDispatcherTarget::TESetStyle,
("InterfaceLib", "TEUseStyleScrap") => PpcImportDispatcherTarget::TEUseStyleScrap,
("InterfaceLib", "TEContinuousStyle") => PpcImportDispatcherTarget::TEContinuousStyle,
("InterfaceLib", "TEGetText") => PpcImportDispatcherTarget::TEGetText,
("InterfaceLib", "TEDispose") | ("InterfaceLib", "TEDispos") => PpcImportDispatcherTarget::TEDispose,
("InterfaceLib", "TEActivate") | ("InterfaceLib", "TEActivat") => PpcImportDispatcherTarget::TEActivate { active: true },
("InterfaceLib", "TEDeactivate") | ("InterfaceLib", "TEDeactivat") => PpcImportDispatcherTarget::TEActivate { active: false },
("InterfaceLib", "TESetSelect") => PpcImportDispatcherTarget::TESetSelect,
("InterfaceLib", "TESetText") => PpcImportDispatcherTarget::TESetText,
("InterfaceLib", "TECalText") => PpcImportDispatcherTarget::TECalText,
("InterfaceLib", "TEInsert") => PpcImportDispatcherTarget::TEInsert { styled: false },
("InterfaceLib", "TEStyleInsert") => PpcImportDispatcherTarget::TEInsert { styled: true },
("InterfaceLib", "TEDelete") => PpcImportDispatcherTarget::TEDelete,
("InterfaceLib", "TEKey") => PpcImportDispatcherTarget::TEKey,
("InterfaceLib", "TEClick") => PpcImportDispatcherTarget::TEClick,
("InterfaceLib", "TEIdle") => PpcImportDispatcherTarget::TEIdle,
("InterfaceLib", "TEUpdate") => PpcImportDispatcherTarget::TEUpdate,
("InterfaceLib", "TETextBox") => PpcImportDispatcherTarget::TETextBox,
("InterfaceLib", "TESetAlignment")
| ("InterfaceLib", "TESetJust") => PpcImportDispatcherTarget::TESetAlignment,
("InterfaceLib", "TEGetHeight") => PpcImportDispatcherTarget::TEGetHeight,
("InterfaceLib", "TEGetPoint") => PpcImportDispatcherTarget::TEGetPoint,
("InterfaceLib", "TEScroll") => PpcImportDispatcherTarget::TEScroll { pinned: false },
("InterfaceLib", "TEPinScroll") => PpcImportDispatcherTarget::TEScroll { pinned: true },
("InterfaceLib", "TEAutoView") => PpcImportDispatcherTarget::TEAutoView,
("InterfaceLib", "TECopy") => PpcImportDispatcherTarget::TECopy {
cut: false,
dialog: false,
},
("InterfaceLib", "TECut") => PpcImportDispatcherTarget::TECopy {
cut: true,
dialog: false,
},
("InterfaceLib", "DialogCopy") => PpcImportDispatcherTarget::TECopy {
cut: false,
dialog: true,
},
("InterfaceLib", "DialogCut") => PpcImportDispatcherTarget::TECopy {
cut: true,
dialog: true,
},
("InterfaceLib", "TEPaste" | "TEStylePaste") => {
PpcImportDispatcherTarget::TEPaste { dialog: false }
}
("InterfaceLib", "DialogPaste") => PpcImportDispatcherTarget::TEPaste { dialog: true },
("InterfaceLib", "TEToScrap") => PpcImportDispatcherTarget::TETransferScrap {
from_desktop: false,
},
("InterfaceLib", "TEFromScrap") => {
PpcImportDispatcherTarget::TETransferScrap { from_desktop: true }
}
("InterfaceLib", "TEScrapHandle") => PpcImportDispatcherTarget::TEScrapHandle,
("InterfaceLib", "LMGetTEScrpLength" | "TEGetScrapLength") => {
PpcImportDispatcherTarget::TEScrapLength { set: false }
}
("InterfaceLib", "LMSetTEScrpLength") => {
PpcImportDispatcherTarget::TEScrapLength { set: true }
}
("InterfaceLib", "SelectDialogItemText") => PpcImportDispatcherTarget::SelectDialogItemText,
("InterfaceLib", "InitDialogs") => PpcImportDispatcherTarget::InitDialogs,
("InterfaceLib", "SystemTask") => PpcImportDispatcherTarget::SystemTask,
("InterfaceLib", "SystemClick") => PpcImportDispatcherTarget::SystemClick,
("InterfaceLib", "OpenDeskAcc") => PpcImportDispatcherTarget::OpenDeskAcc,
("InterfaceLib", "AEProcessAppleEvent") => PpcImportDispatcherTarget::AEProcessAppleEvent,
("InterfaceLib", "LNew") => PpcImportDispatcherTarget::LNew,
("InterfaceLib", "LDispose") => PpcImportDispatcherTarget::LDispose,
("InterfaceLib", "LAddRow") => PpcImportDispatcherTarget::LAddRow,
("InterfaceLib", "LDelRow") => PpcImportDispatcherTarget::LDelRow,
("InterfaceLib", "LGetSelect") => PpcImportDispatcherTarget::LGetSelect,
("InterfaceLib", "LSetSelect") => PpcImportDispatcherTarget::LSetSelect,
("InterfaceLib", "LSetCell") => PpcImportDispatcherTarget::LSetCell,
("InterfaceLib", "LGetCell") => PpcImportDispatcherTarget::LGetCell,
("InterfaceLib", "LClick") => PpcImportDispatcherTarget::LClick,
("InterfaceLib", "LActivate") => PpcImportDispatcherTarget::LActivate,
("InterfaceLib", "LSetDrawingMode") => PpcImportDispatcherTarget::LSetDrawingMode,
("InterfaceLib", "LScroll") => PpcImportDispatcherTarget::LScroll,
("InterfaceLib", "LSize") => PpcImportDispatcherTarget::LSize,
("InterfaceLib", "LUpdate") => PpcImportDispatcherTarget::LUpdate,
("InterfaceLib", "LAutoScroll") => PpcImportDispatcherTarget::LAutoScroll,
("InterfaceLib", "LSearch") => PpcImportDispatcherTarget::LSearch,
("InterfaceLib", "FlushEvents") => {
PpcImportDispatcherTarget::FlushEvents
}
("InterfaceLib", "SetEventMask") => PpcImportDispatcherTarget::SetEventMask,
("InterfaceLib", "CloseDialog") => PpcImportDispatcherTarget::CloseDialog,
("InterfaceLib", "DisposeDialog" | "DisposDialog") => {
PpcImportDispatcherTarget::DisposeDialog
}
("InterfaceLib", "GetNextEvent") => PpcImportDispatcherTarget::GetNextEvent(
PpcEventPollOperation::GetNextEvent,
),
("InterfaceLib", "WaitNextEvent") => {
PpcImportDispatcherTarget::GetNextEvent(PpcEventPollOperation::WaitNextEvent)
}
("InterfaceLib", "GetOSEvent") => PpcImportDispatcherTarget::GetOSEvent,
("InterfaceLib", "EventAvail") => PpcImportDispatcherTarget::EventAvail,
("InterfaceLib", "OSEventAvail") => PpcImportDispatcherTarget::OSEventAvail,
("InterfaceLib", "PostEvent") => PpcImportDispatcherTarget::PostEvent,
("InterfaceLib", "Button") => PpcImportDispatcherTarget::Button,
("InterfaceLib", "StillDown") => PpcImportDispatcherTarget::StillDown,
("InterfaceLib", "WaitMouseUp") => PpcImportDispatcherTarget::WaitMouseUp,
("InterfaceLib", "GetKeys") => PpcImportDispatcherTarget::GetKeys,
("InterfaceLib", "GetDateTime") => PpcImportDispatcherTarget::GetDateTime,
("InterfaceLib", "ReadDateTime") => PpcImportDispatcherTarget::ReadDateTime,
("InterfaceLib", "ReadLocation") => PpcImportDispatcherTarget::ReadLocation,
("InterfaceLib", "GetTime") => PpcImportDispatcherTarget::GetTime,
("InterfaceLib", "Delay") => PpcImportDispatcherTarget::Delay,
("InterfaceLib", "GetDblTime") => PpcImportDispatcherTarget::GetDblTime,
("InterfaceLib", "LMGetTime") => PpcImportDispatcherTarget::LMGetTime,
("InterfaceLib", "LMGetUTableBase") => PpcImportDispatcherTarget::LMGetUTableBase,
("InterfaceLib", "LMGetCurDirStore") => PpcImportDispatcherTarget::LMGetCurDirStore,
("InterfaceLib", "LMSetCurDirStore") => PpcImportDispatcherTarget::LMSetCurDirStore,
("InterfaceLib", "LMGetSFSaveDisk") => PpcImportDispatcherTarget::LMGetSFSaveDisk,
("InterfaceLib", "LMSetSFSaveDisk") => PpcImportDispatcherTarget::LMSetSFSaveDisk,
("InterfaceLib", "LMGetRndSeed") => PpcImportDispatcherTarget::LMGetRndSeed,
("InterfaceLib", "LMSetRndSeed") => PpcImportDispatcherTarget::LMSetRndSeed,
("InterfaceLib", "SetCurrentA5") => PpcImportDispatcherTarget::SetCurrentA5,
("InterfaceLib", "SetA5") => PpcImportDispatcherTarget::SetA5,
("InterfaceLib", "SecondsToDate") | ("InterfaceLib", "Secs2Date") => {
PpcImportDispatcherTarget::SecondsToDate
}
("InterfaceLib", "Microseconds") => PpcImportDispatcherTarget::Microseconds,
("DriverServicesLib", "UpTime") => PpcImportDispatcherTarget::Microseconds,
("DriverServicesLib", "AbsoluteToNanoseconds") => {
PpcImportDispatcherTarget::AbsoluteToNanoseconds
}
("InterfaceLib", "LMGetTicks") => PpcImportDispatcherTarget::TickCount,
("InterfaceLib", "SysEnvirons") => PpcImportDispatcherTarget::SysEnvirons,
("InterfaceLib", "TextWidth") => PpcImportDispatcherTarget::TextWidth,
("InterfaceLib", "StringWidth") => PpcImportDispatcherTarget::StringWidth,
("InterfaceLib", "TruncString") => PpcImportDispatcherTarget::TruncString,
("InterfaceLib", "CharWidth") => PpcImportDispatcherTarget::CharWidth,
("InterfaceLib", "MeasureText") => PpcImportDispatcherTarget::MeasureText,
("InterfaceLib", "RealFont") => PpcImportDispatcherTarget::RealFont,
("InterfaceLib", "GetFontInfo") => PpcImportDispatcherTarget::GetFontInfo,
("InterfaceLib", "FontMetrics") => PpcImportDispatcherTarget::FontMetrics,
("InterfaceLib", "GetFNum") => PpcImportDispatcherTarget::GetFNum,
("InterfaceLib", "GetIntlResource") => PpcImportDispatcherTarget::GetIntlResource,
("InterfaceLib", "AESetInteractionAllowed") => {
PpcImportDispatcherTarget::AESetInteractionAllowed
}
("InterfaceLib", "AEGetInteractionAllowed") => {
PpcImportDispatcherTarget::AEGetInteractionAllowed
}
("InterfaceLib", "SVersion") => PpcImportDispatcherTarget::SVersion,
("InterfaceLib", "EqualString") => PpcImportDispatcherTarget::EqualString,
("InterfaceLib", "IUEqualPString") => PpcImportDispatcherTarget::IUEqualPString,
("InterfaceLib", "NumToString") => PpcImportDispatcherTarget::NumToString,
("InterfaceLib", "StringToNum") => PpcImportDispatcherTarget::StringToNum,
("InterfaceLib", "Random") => PpcImportDispatcherTarget::Random,
("InterfaceLib", "BitAnd") => PpcImportDispatcherTarget::BitAnd,
("InterfaceLib", "BitOr") => PpcImportDispatcherTarget::BitOr,
("InterfaceLib", "BitTst") => PpcImportDispatcherTarget::BitTst,
("InterfaceLib", "p2cstr") | ("InterfaceLib", "P2CStr") => {
PpcImportDispatcherTarget::P2CStr
}
("InterfaceLib", "c2pstr") | ("InterfaceLib", "C2PStr") => {
PpcImportDispatcherTarget::C2PStr
}
("InterfaceLib", "CopyCStringToPascal") => {
PpcImportDispatcherTarget::CopyCStringToPascal
}
("InterfaceLib", "CopyPascalStringToC") => {
PpcImportDispatcherTarget::CopyPascalStringToC
}
("InterfaceLib", "__CFStringMakeConstantString") => {
PpcImportDispatcherTarget::CfStringMakeConstantString
}
("InterfaceLib", "CFStringCreateWithCString") => {
PpcImportDispatcherTarget::CfStringCreateWithCString
}
("InterfaceLib", "CFStringCreateWithPascalString") => {
PpcImportDispatcherTarget::CfStringCreateWithPascalString
}
("InterfaceLib", "CFStringCreateWithBytes") => {
PpcImportDispatcherTarget::CfStringCreateWithBytes
}
("InterfaceLib", "CFStringGetCString") => PpcImportDispatcherTarget::CfStringGetCString,
("InterfaceLib", "CFStringGetBytes") => PpcImportDispatcherTarget::CfStringGetBytes,
("InterfaceLib", "CFStringGetLength") => PpcImportDispatcherTarget::CfStringGetLength,
("InterfaceLib", "CFStringGetSystemEncoding") => {
PpcImportDispatcherTarget::CfStringGetSystemEncoding
}
("InterfaceLib", "CFRetain") => PpcImportDispatcherTarget::CfRetain,
("InterfaceLib", "CFRelease") => PpcImportDispatcherTarget::CfRelease,
("InterfaceLib", "CFGetRetainCount") => PpcImportDispatcherTarget::CfGetRetainCount,
("InterfaceLib", "CFBundleGetBundleWithIdentifier") => {
PpcImportDispatcherTarget::CfBundleGetBundleWithIdentifier
}
("InterfaceLib", "UpperText") => PpcImportDispatcherTarget::UpperText,
("InterfaceLib" | "ThreadsLib", "GetCurrentThread" | "MacGetCurrentThread") => {
PpcImportDispatcherTarget::GetCurrentThread
}
("InterfaceLib", "NewThreadEntryUPP") => {
PpcImportDispatcherTarget::NewThreadEntryUPP
}
("InterfaceLib", "DisposeThreadEntryUPP") => {
PpcImportDispatcherTarget::DisposeThreadEntryUPP
}
("InterfaceLib", "NewThreadTerminationUPP") => {
PpcImportDispatcherTarget::NewThreadTerminationUPP
}
("InterfaceLib", "DisposeThreadTerminationUPP") => {
PpcImportDispatcherTarget::DisposeThreadTerminationUPP
}
("InterfaceLib", "NewThreadSwitchUPP") => {
PpcImportDispatcherTarget::NewThreadSwitchUPP
}
("InterfaceLib", "DisposeThreadSwitchUPP") => {
PpcImportDispatcherTarget::DisposeThreadSwitchUPP
}
("InterfaceLib" | "ThreadsLib", "SetThreadTerminator") => {
PpcImportDispatcherTarget::SetThreadTerminator
}
("InterfaceLib" | "ThreadsLib", "SetThreadSwitcher") => {
PpcImportDispatcherTarget::SetThreadSwitcher
}
("InterfaceLib" | "ThreadsLib", "GetThreadCurrentTaskRef") => {
PpcImportDispatcherTarget::GetThreadCurrentTaskRef
}
("InterfaceLib" | "ThreadsLib", "GetThreadStateGivenTaskRef") => {
PpcImportDispatcherTarget::GetThreadStateGivenTaskRef
}
("InterfaceLib" | "ThreadsLib", "SetThreadReadyGivenTaskRef") => {
PpcImportDispatcherTarget::SetThreadReadyGivenTaskRef
}
("InterfaceLib" | "ThreadsLib", "GetThreadState") => PpcImportDispatcherTarget::GetThreadState,
("InterfaceLib" | "ThreadsLib", "SetThreadState") => PpcImportDispatcherTarget::SetThreadState,
("InterfaceLib" | "ThreadsLib", "SetThreadStateEndCritical") => {
PpcImportDispatcherTarget::SetThreadStateEndCritical
}
("InterfaceLib" | "ThreadsLib", "CreateThreadPool") => PpcImportDispatcherTarget::CreateThreadPool,
("InterfaceLib" | "ThreadsLib", "GetFreeThreadCount") => PpcImportDispatcherTarget::GetFreeThreadCount,
("InterfaceLib" | "ThreadsLib", "GetSpecificFreeThreadCount") => {
PpcImportDispatcherTarget::GetSpecificFreeThreadCount
}
("InterfaceLib" | "ThreadsLib", "GetDefaultThreadStackSize") => {
PpcImportDispatcherTarget::GetDefaultThreadStackSize
}
("InterfaceLib" | "ThreadsLib", "ThreadCurrentStackSpace") => {
PpcImportDispatcherTarget::ThreadCurrentStackSpace
}
("InterfaceLib" | "ThreadsLib", "NewThread") => PpcImportDispatcherTarget::NewThread,
("InterfaceLib" | "ThreadsLib", "YieldToThread") => PpcImportDispatcherTarget::YieldToThread,
("InterfaceLib" | "ThreadsLib", "YieldToAnyThread") => PpcImportDispatcherTarget::YieldToAnyThread,
("InterfaceLib" | "ThreadsLib", "DisposeThread") => PpcImportDispatcherTarget::DisposeThread,
("InterfaceLib" | "ThreadsLib", "ThreadBeginCritical") => PpcImportDispatcherTarget::ThreadBeginCritical,
("InterfaceLib" | "ThreadsLib", "ThreadEndCritical") => PpcImportDispatcherTarget::ThreadEndCritical,
("InterfaceLib", "GetCurrentProcess" | "GetFrontProcess") => {
PpcImportDispatcherTarget::GetCurrentProcess
}
("InterfaceLib", "WakeUpProcess") => PpcImportDispatcherTarget::WakeUpProcess,
("InterfaceLib", "SameProcess") => PpcImportDispatcherTarget::SameProcess,
("InterfaceLib", "GetProcessInformation") => {
PpcImportDispatcherTarget::GetProcessInformation
}
("InterfaceLib", "ExitToShell") => PpcImportDispatcherTarget::ExitToShell,
("InterfaceLib", "SndSoundManagerVersion") => {
PpcImportDispatcherTarget::SndSoundManagerVersion
}
("SoundLib" | "InterfaceLib", "UnsignedFixedMulDiv" | "UnsignedFixMulDiv") => {
PpcImportDispatcherTarget::UnsignedFixedMulDiv
}
("SoundLib" | "InterfaceLib", "GetSoundOutputInfo") => {
PpcImportDispatcherTarget::GetSoundOutputInfo
}
("SoundLib", "GetCompressionInfo") => PpcImportDispatcherTarget::GetCompressionInfo,
("InterfaceLib", "GetSoundVol") => PpcImportDispatcherTarget::GetSoundVol,
("InterfaceLib", "SetSoundVol") => PpcImportDispatcherTarget::SetSoundVol,
("InterfaceLib", "GetDefaultOutputVolume") => {
PpcImportDispatcherTarget::GetDefaultOutputVolume
}
("InterfaceLib", "SetDefaultOutputVolume") => {
PpcImportDispatcherTarget::SetDefaultOutputVolume
}
("InterfaceLib", "GetVol") => PpcImportDispatcherTarget::GetVol,
("InterfaceLib", "GetWDInfo") => PpcImportDispatcherTarget::GetWDInfo,
("InterfaceLib", "HGetVol") => PpcImportDispatcherTarget::HGetVol,
("InterfaceLib", "HSetVol") => PpcImportDispatcherTarget::HSetVol,
("InterfaceLib", "FlushVol") => PpcImportDispatcherTarget::FlushVol,
("InterfaceLib", "PBFlushVol")
| ("InterfaceLib", "PBFlushVolSync")
| ("InterfaceLib", "PBFlushVolAsync") => PpcImportDispatcherTarget::PBFlushVol,
("InterfaceLib", "SndNewChannel") => PpcImportDispatcherTarget::SndNewChannel,
("InterfaceLib", "SndDisposeChannel") => PpcImportDispatcherTarget::SndDisposeChannel,
("InterfaceLib", "SndPlay") => PpcImportDispatcherTarget::SndPlay,
("InterfaceLib", "SndChannelStatus") => PpcImportDispatcherTarget::SndChannelStatus,
("SoundLib" | "InterfaceLib", "SndGetInfo") => PpcImportDispatcherTarget::SndGetInfo,
("SoundLib" | "InterfaceLib", "SndSetInfo") => PpcImportDispatcherTarget::SndSetInfo,
("SoundLib", "ParseSndHeader") => PpcImportDispatcherTarget::ParseSndHeader,
("InterfaceLib", "SndDoImmediate") => PpcImportDispatcherTarget::SndDoImmediate,
("InterfaceLib", "SndDoCommand") => PpcImportDispatcherTarget::SndDoCommand,
("InterfaceLib", "SndPlayDoubleBuffer") => PpcImportDispatcherTarget::SndPlayDoubleBuffer,
("InterfaceLib", "SndStartFilePlay") => PpcImportDispatcherTarget::SndStartFilePlay,
("InterfaceLib", "SndPauseFilePlay") => PpcImportDispatcherTarget::SndPauseFilePlay,
("InterfaceLib", "SndStopFilePlay") => PpcImportDispatcherTarget::SndStopFilePlay,
("InterfaceLib", "GetSoundHeaderOffset") => PpcImportDispatcherTarget::GetSoundHeaderOffset,
("InterfaceLib", "CloseComponent") => PpcImportDispatcherTarget::CloseComponent,
("QuickTimeLib", "GetGraphicsImporterForFile") => {
PpcImportDispatcherTarget::QtGetGraphicsImporterForFile
}
("InterfaceLib", "OpenADefaultComponent") => {
PpcImportDispatcherTarget::QtOpenADefaultComponent
}
("QuickTimeLib", "GraphicsImportSetDataHandle") => {
PpcImportDispatcherTarget::QtGraphicsImportSetDataHandle
}
("QuickTimeLib", "GraphicsImportGetImageDescription") => {
PpcImportDispatcherTarget::QtGraphicsImportGetImageDescription
}
("QuickTimeLib", "GraphicsImportGetBoundsRect") => {
PpcImportDispatcherTarget::QtGraphicsImportGetBoundsRect
}
("QuickTimeLib", "GraphicsImportSetGWorld") => {
PpcImportDispatcherTarget::QtGraphicsImportSetGWorld
}
("QuickTimeLib", "GraphicsImportDraw") => PpcImportDispatcherTarget::QtGraphicsImportDraw,
("QuickTimeLib", "OpenMovieFile") => PpcImportDispatcherTarget::QtOpenMovieFile,
("QuickTimeLib", "NewMovieFromFile") => PpcImportDispatcherTarget::QtNewMovieFromFile,
("QuickTimeLib", "GetMovieBox") => PpcImportDispatcherTarget::QtGetMovieBox,
("QuickTimeLib", "SetMovieBox") => PpcImportDispatcherTarget::QtSetMovieBox,
("QuickTimeLib", "SetMovieGWorld") => PpcImportDispatcherTarget::QtSetMovieGWorld,
("QuickTimeLib", "StartMovie") => PpcImportDispatcherTarget::QtStartMovie,
("QuickTimeLib", "StopMovie") => PpcImportDispatcherTarget::QtStopMovie,
("QuickTimeLib", "MoviesTask") => PpcImportDispatcherTarget::QtMoviesTask,
("QuickTimeLib", "DisposeMovie") => PpcImportDispatcherTarget::QtDisposeMovie,
("QuickTimeLib", "IsMovieDone") => PpcImportDispatcherTarget::QtIsMovieDone,
("QuickTimeLib", "GoToBeginningOfMovie") => {
PpcImportDispatcherTarget::QtGoToBeginningOfMovie
}
("QuickTimeLib", "GoToEndOfMovie") => PpcImportDispatcherTarget::QtGoToEndOfMovie,
("QuickTimeLib", "GetMovieDuration") => PpcImportDispatcherTarget::QtGetMovieDuration,
("QuickTimeLib", "LoadMovieIntoRam") => PpcImportDispatcherTarget::QtLoadMovieIntoRam,
("QuickTimeLib", "CloseMovieFile") => PpcImportDispatcherTarget::QtCloseMovieFile,
("QuickTimeLib", "EnterMovies") => PpcImportDispatcherTarget::QtEnterMovies,
("QuickTimeLib", "ExitMovies") => PpcImportDispatcherTarget::QtExitMovies,
("QuickTimeLib", "GetMoviesError") => PpcImportDispatcherTarget::QtGetMoviesError,
("QuickTimeLib", "GetMoviesStickyError") => {
PpcImportDispatcherTarget::QtGetMoviesStickyError
}
("QuickTimeLib", "ClearMoviesStickyError") => {
PpcImportDispatcherTarget::QtClearMoviesStickyError
}
("InterfaceLib", "ParamText") | ("InterfaceLib", "paramtext") => {
PpcImportDispatcherTarget::ParamText
}
("InterfaceLib", "X2Fix") => PpcImportDispatcherTarget::X2Fix,
("InterfaceLib", "Alert" | "StopAlert" | "NoteAlert" | "CautionAlert") => {
PpcImportDispatcherTarget::AlertReturnDefault
}
("InterfaceLib" | "AppearanceLib", "StandardAlert") => {
PpcImportDispatcherTarget::StandardAlert
}
("InterfaceLib", "PurgeMem") => PpcImportDispatcherTarget::PurgeMem,
("InterfaceLib", "PurgeMemSys") => PpcImportDispatcherTarget::PurgeMemSys,
("InterfaceLib", "ReleaseResource") => PpcImportDispatcherTarget::ReleaseResource,
("InterfaceLib", "DetachResource") => PpcImportDispatcherTarget::DetachResource,
("InterfaceLib", "ReadPartialResource") => PpcImportDispatcherTarget::ReadPartialResource,
("InterfaceLib", "GetIcon") => PpcImportDispatcherTarget::GetIcon,
("InterfaceLib", "GetIconSuite") => PpcImportDispatcherTarget::GetIconSuite,
("InterfaceLib", "GetPattern") => PpcImportDispatcherTarget::GetPattern,
("InterfaceLib", "NewRoutineDescriptor") => PpcImportDispatcherTarget::NewRoutineDescriptor,
("InterfaceLib", "NewIOCompletionUPP") => {
PpcImportDispatcherTarget::NewIOCompletionUPP
}
("InterfaceLib", "DisposeIOCompletionUPP") => {
PpcImportDispatcherTarget::DisposeIOCompletionUPP
}
("InterfaceLib", "NewControlUserPaneDrawUPP") => {
PpcImportDispatcherTarget::NewControlUserPaneDrawUPP
}
("InterfaceLib", "DisposeControlUserPaneDrawUPP") => {
PpcImportDispatcherTarget::DisposeControlUserPaneDrawUPP
}
("InterfaceLib", "NewAEEventHandlerUPP") => {
PpcImportDispatcherTarget::NewAEEventHandlerUPP
}
("InterfaceLib", "DisposeAEEventHandlerUPP") => {
PpcImportDispatcherTarget::DisposeAEEventHandlerUPP
}
("InterfaceLib", "NewFatRoutineDescriptor") => {
PpcImportDispatcherTarget::NewFatRoutineDescriptor
}
("InterfaceLib", "DisposeRoutineDescriptor") => {
PpcImportDispatcherTarget::DisposeRoutineDescriptor
}
("InterfaceLib", "CallUniversalProc") => PpcImportDispatcherTarget::CallUniversalProc,
("InterfaceLib", "CallOSTrapUniversalProc") => {
PpcImportDispatcherTarget::CallOSTrapUniversalProc
}
("InterfaceLib", "NGetTrapAddress") => PpcImportDispatcherTarget::NGetTrapAddress,
("InterfaceLib", "GetToolTrapAddress") | ("InterfaceLib", "GetToolboxTrapAddress") => {
PpcImportDispatcherTarget::GetToolTrapAddress
}
("InterfaceLib", "GetOSTrapAddress") => PpcImportDispatcherTarget::GetOSTrapAddress,
("InterfaceLib", "SetToolTrapAddress") | ("InterfaceLib", "SetToolboxTrapAddress") => {
PpcImportDispatcherTarget::SetToolTrapAddress
}
("InterfaceLib", "SetOSTrapAddress") => PpcImportDispatcherTarget::SetOSTrapAddress,
("InterfaceLib", "NSetTrapAddress") => PpcImportDispatcherTarget::NSetTrapAddress,
("InterfaceLib", "LMGetCurrentA5") => PpcImportDispatcherTarget::LMGetCurrentA5,
("InterfaceLib", "InsTime") => PpcImportDispatcherTarget::InsTime,
("InterfaceLib", "InsXTime") => PpcImportDispatcherTarget::InsXTime,
("InterfaceLib", "PrimeTime") => PpcImportDispatcherTarget::PrimeTime,
("InterfaceLib", "RmvTime") => PpcImportDispatcherTarget::RmvTime,
("InterfaceLib", "VInstall") => PpcImportDispatcherTarget::VInstall,
("InterfaceLib", "VRemove") => PpcImportDispatcherTarget::VRemove,
("InterfaceLib", "SlotVInstall") => PpcImportDispatcherTarget::SlotVInstall,
("InterfaceLib", "SlotVRemove") => PpcImportDispatcherTarget::SlotVRemove,
("InterfaceLib", "BitClr") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::BitClear,
),
("InterfaceLib", "BitNot") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::BitNot,
),
("InterfaceLib", "BitSet") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::BitSet,
),
("InterfaceLib", "Fix2X") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::FixToExtended,
),
("InterfaceLib", "GetMyZone") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::GetMyZone,
),
("InterfaceLib", "HandleZone") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::HandleZone,
),
("InterfaceLib", "LockMemory") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::LockMemory,
),
("InterfaceLib", "MaxBlock") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::MaxBlock,
),
("InterfaceLib", "PurgeSpace") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::PurgeSpace,
),
("InterfaceLib", "ReserveMem") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::ReserveMem,
),
("InterfaceLib", "SetGrowZone") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::SetGrowZone,
),
("InterfaceLib", "StackSpace") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::StackSpace,
),
("InterfaceLib", "TempFreeMem") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::TempFreeMem,
),
("InterfaceLib", "UnlockMemory") => PpcImportDispatcherTarget::LegacyMemoryUtility(
PpcLegacyMemoryUtilityOperation::UnlockMemory,
),
("InterfaceLib", "DisposeControl") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::DisposeControl,
),
("InterfaceLib", "Draw1Control") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::DrawOneControl,
),
("InterfaceLib", "FindControl") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::FindControl,
),
("InterfaceLib", "GetControlMaximum") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::GetControlMaximum,
),
("InterfaceLib", "GetControlAction") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::GetControlAction,
),
("InterfaceLib", "GetControlReference") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::GetControlReference,
),
("InterfaceLib", "GetControlMinimum") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::GetControlMinimum,
),
("InterfaceLib", "GetControlTitle") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::GetControlTitle,
),
("InterfaceLib", "GetControlValue") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::GetControlValue,
),
("InterfaceLib", "GetNewControl") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::GetNewControl,
),
("InterfaceLib", "HideControl") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::HideControl,
),
("InterfaceLib", "KillControls") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::KillControls,
),
("InterfaceLib", "MoveControl") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::MoveControl,
),
("InterfaceLib", "NewControl") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::NewControl,
),
("InterfaceLib", "SetControlMaximum") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::SetControlMaximum,
),
("InterfaceLib", "SetControlAction") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::SetControlAction,
),
("InterfaceLib", "SetControlReference") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::SetControlReference,
),
("InterfaceLib", "SetControlMinimum") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::SetControlMinimum,
),
("InterfaceLib", "ShowControl") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::ShowControl,
),
("InterfaceLib", "SizeControl") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::SizeControl,
),
("InterfaceLib", "TestControl") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::TestControl,
),
("InterfaceLib", "TrackControl") => PpcImportDispatcherTarget::LegacyControl(
PpcLegacyControlOperation::TrackControl,
),
("InterfaceLib", "BringToFront") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::BringToFront,
),
("InterfaceLib", "CalcVis") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::CalculateVisibleRegion,
),
("InterfaceLib", "CheckUpdate") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::CheckUpdate,
),
("InterfaceLib", "CreateNewWindow") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::CreateNewWindow,
),
("InterfaceLib", "DisposeWindow") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::DisposeWindow,
),
("InterfaceLib", "DragWindow") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::DragWindow,
),
("InterfaceLib", "GetNewWindow") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::GetNewWindow,
),
("InterfaceLib", "GetWTitle") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::GetWindowTitle,
),
("InterfaceLib", "GrowWindow") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::GrowWindow,
),
("InterfaceLib", "HiliteWindow") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::HighlightWindow,
),
("InterfaceLib", "NewWindow") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::NewWindow,
),
("InterfaceLib", "RepositionWindow") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::RepositionWindow,
),
("InterfaceLib", "SendBehind") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::SendBehind,
),
("InterfaceLib", "SetWTitle") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::SetWindowTitle,
),
("InterfaceLib", "TrackBox") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::TrackBox,
),
("InterfaceLib", "TrackGoAway") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::TrackGoAway,
),
("InterfaceLib", "ZoomWindow") => PpcImportDispatcherTarget::LegacyWindow(
PpcLegacyWindowOperation::ZoomWindow,
),
("InterfaceLib", "AECountItems") => PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::CountItems,
),
("InterfaceLib", "AECreateAppleEvent") => {
PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::CreateAppleEvent,
)
}
("InterfaceLib", "AECreateDesc") => PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::CreateDesc,
),
("InterfaceLib", "AEDisposeDesc") => {
PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::DisposeDesc,
)
}
("InterfaceLib", "AEGetAttributePtr") => {
PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::GetAttributePtr,
)
}
("InterfaceLib", "AEGetNthPtr") => PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::GetNthPtr,
),
("InterfaceLib", "AEGetParamDesc") => {
PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::GetParamDesc,
)
}
("InterfaceLib", "AEGetParamPtr") => {
PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::GetParamPtr,
)
}
("InterfaceLib", "AEPutParamDesc") => {
PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::PutParamDesc,
)
}
("InterfaceLib", "AEPutParamPtr") => PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::PutParamPtr,
),
("InterfaceLib", "AESend") => PpcImportDispatcherTarget::AppleEventCompatibility(
PpcAppleEventCompatibilityOperation::Send,
),
("InterfaceLib", "AppendDITL") => PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::AppendDitl,
),
("InterfaceLib", "CountDITL") => PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::CountDitl,
),
("InterfaceLib", "DialogSelect") => PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::DialogSelect,
),
("InterfaceLib", "FindDialogItem") => PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::FindDialogItem,
),
("InterfaceLib", "HideDialogItem") => PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::HideDialogItem,
),
("InterfaceLib", "IsDialogEvent") => PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::IsDialogEvent,
),
("InterfaceLib", "ShortenDITL") => PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::ShortenDitl,
),
("InterfaceLib", "ShowDialogItem") => PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::ShowDialogItem,
),
("InterfaceLib", "UpdateDialog") => PpcImportDispatcherTarget::DialogCompatibility(
PpcDialogCompatibilityOperation::UpdateDialog,
),
("InterfaceLib", "AnimateEntry") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::AnimateEntry),
("InterfaceLib", "AnimatePalette") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::AnimatePalette),
("InterfaceLib", "BackPat") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::BackPat),
("InterfaceLib", "BackPixPat") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::BackPixPat),
("InterfaceLib", "ClosePicture") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::ClosePicture),
("InterfaceLib", "CopyDeepMask") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::CopyDeepMask),
("InterfaceLib", "CopyMask") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::CopyMask),
("InterfaceLib", "CopyPalette") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::CopyPalette),
("InterfaceLib", "CTab2Palette") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::Ctab2Palette),
("InterfaceLib", "DisposeGDevice") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::DisposeGDevice),
("InterfaceLib", "DisposePalette") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::DisposePalette),
("InterfaceLib", "Exp1to3") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::Exp1To3),
("InterfaceLib", "Exp1to6") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::Exp1To6),
("InterfaceLib", "GetCPixel") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::GetCPixel),
("InterfaceLib", "GetEntryUsage") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::GetEntryUsage),
("InterfaceLib", "GetItemIcon") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::GetItemIcon),
("InterfaceLib", "GetItemStyle") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::GetItemStyle),
("InterfaceLib", "GetNewPalette") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::GetNewPalette),
("InterfaceLib", "NewGDevice") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::NewGDevice),
("InterfaceLib", "NewPalette") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::NewPalette),
("InterfaceLib", "OpenPicture") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::OpenPicture),
("InterfaceLib", "Palette2CTab") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::Palette2Ctab),
("InterfaceLib", "PenPat") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::PenPat),
("InterfaceLib", "PlotIcon") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::PlotIcon),
("InterfaceLib", "ScrollRect") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::ScrollRect),
("InterfaceLib", "SetCPixel") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::SetCPixel),
("InterfaceLib", "SetEntryColor") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::SetEntryColor),
("InterfaceLib", "SetEntryUsage") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::SetEntryUsage),
("InterfaceLib", "SetItemIcon") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::SetItemIcon),
("InterfaceLib", "SetItemStyle") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::SetItemStyle),
("InterfaceLib", "SetStdCProcs") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::SetStdCProcs),
("InterfaceLib", "SetStdProcs") => PpcImportDispatcherTarget::QuickDrawCompatibility(PpcQuickDrawCompatibilityOperation::SetStdProcs),
("InterfaceLib", "BuildDDPwds") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::BuildDdPwds),
("InterfaceLib", "CTBGetCTBVersion") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::CtbGetCtbVersion),
("InterfaceLib", "CallComponentUPP") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::CallComponentUpp),
("InterfaceLib", "DIBadMount") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::DiBadMount),
("InterfaceLib", "DILoad") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::DiLoad),
("InterfaceLib", "DIUnload") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::DiUnload),
("InterfaceLib", "Debugger") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::Debugger),
("InterfaceLib", "Dequeue") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::Dequeue),
("InterfaceLib", "Enqueue") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::Enqueue),
("InterfaceLib", "FindNextComponent") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::FindNextComponent),
("InterfaceLib", "GetNextProcess") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::GetNextProcess),
("InterfaceLib", "GetScript") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::GetScript),
("InterfaceLib", "GetScriptManagerVariable") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::GetScriptManagerVariable),
("InterfaceLib", "GetScriptVariable") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::GetScriptVariable),
("InterfaceLib", "GetSysBeepVolume") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::GetSysBeepVolume),
("InterfaceLib", "IUCompString") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::IuCompString),
("InterfaceLib", "IUDateString") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::IuDateString),
("InterfaceLib", "InitCRM") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::InitCrm),
("InterfaceLib", "InitCTBUtilities") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::InitCtbUtilities),
("InterfaceLib", "KeyTranslate") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::KeyTranslate),
("InterfaceLib", "LMGetCurApName") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::LmGetCurApName),
("InterfaceLib", "LMGetSysFontFam") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::LmGetSysFontFam),
("InterfaceLib", "LMGetSysFontSize") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::LmGetSysFontSize),
("InterfaceLib", "LaunchApplication") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::LaunchApplication),
("InterfaceLib", "MIDIAddPort") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::MidiAddPort),
("InterfaceLib", "MIDIRemovePort") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::MidiRemovePort),
("InterfaceLib", "MIDISignOut") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::MidiSignOut),
("InterfaceLib", "MIDIWritePacket") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::MidiWritePacket),
("InterfaceLib", "Munger") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::Munger),
("InterfaceLib", "NMRemove") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::NmRemove),
("InterfaceLib", "ObscureCursor") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::ObscureCursor),
("InterfaceLib", "OpenDefaultComponent") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::OpenDefaultComponent),
("InterfaceLib", "ResetAlertStage") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::ResetAlertStage),
("InterfaceLib", "SetFrontProcess") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::SetFrontProcess),
("InterfaceLib", "StyledLineBreak") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::StyledLineBreak),
("InterfaceLib", "SystemEdit") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::SystemEdit),
("InterfaceLib", "TruncText") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::TruncText),
("InterfaceLib", "UpperString") => PpcImportDispatcherTarget::SystemCompatibility(PpcSystemCompatibilityOperation::UpperString),
("InterfaceLib", "OpenDF") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::OpenDf),
("InterfaceLib", "OpenRF") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::OpenRf),
("InterfaceLib", "PBCatSearchSync") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::PbCatSearchSync),
("InterfaceLib", "PBCloseWDSync") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::PbCloseWdSync),
("InterfaceLib", "PBDirCreateSync") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::PbDirCreateSync),
("InterfaceLib", "PBGetFPosSync") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::PbGetFPosSync),
("InterfaceLib", "PBGetWDInfoSync") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::PbGetWdInfoSync),
("InterfaceLib", "PBHGetVolParmsSync") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::PbHGetVolParmsSync),
("InterfaceLib", "PBHGetVolSync") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::PbHGetVolSync),
("InterfaceLib", "PBHOpenRFSync") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::PbHOpenRfSync),
("InterfaceLib", "PBHSetVolSync") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::PbHSetVolSync),
("InterfaceLib", "PBOpenWDSync") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::PbOpenWdSync),
("InterfaceLib", "create") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::Create),
("InterfaceLib", "fsopen") => PpcImportDispatcherTarget::FileCompatibility(PpcFileCompatibilityOperation::FsOpen),
("InterfaceLib", "GetBridgeAddress") => {
PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::GetBridgeAddress,
)
}
("InterfaceLib", "GetNodeAddress") => {
PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::GetNodeAddress,
)
}
("InterfaceLib", "GetZoneList") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::GetZoneList,
),
("InterfaceLib", "MPPOpen") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::MppOpen,
),
("InterfaceLib", "NBPExtract") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::NbpExtract,
),
("InterfaceLib", "NBPSetEntity") => {
PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::NbpSetEntity,
)
}
("InterfaceLib", "NBPSetNTE") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::NbpSetNte,
),
("InterfaceLib", "PCloseSkt") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::PCloseSkt,
),
("InterfaceLib", "PKillNBP") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::PKillNbp,
),
("InterfaceLib", "PLookupName") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::PLookupName,
),
("InterfaceLib", "POpenSkt") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::POpenSkt,
),
("InterfaceLib", "PRegisterName") => {
PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::PRegisterName,
)
}
("InterfaceLib", "PRemoveName") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::PRemoveName,
),
("InterfaceLib", "PSetSelfSend") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::PSetSelfSend,
),
("InterfaceLib", "PWriteDDP") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::PWriteDdp,
),
("InterfaceLib", "StandardNBP") => PpcImportDispatcherTarget::AppleTalkCompatibility(
PpcAppleTalkCompatibilityOperation::StandardNbp,
),
("InterfaceLib", "PrClose") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrClose,
),
("InterfaceLib", "PrCloseDoc") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrCloseDoc,
),
("InterfaceLib", "PrClosePage") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrClosePage,
),
("InterfaceLib", "PrError") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrError,
),
("InterfaceLib", "PrJobDialog") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrJobDialog,
),
("InterfaceLib", "PrOpen") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrOpen,
),
("InterfaceLib", "PrOpenDoc") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrOpenDoc,
),
("InterfaceLib", "PrOpenPage") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrOpenPage,
),
("InterfaceLib", "PrPicFile") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrPicFile,
),
("InterfaceLib", "PrStlDialog") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrStlDialog,
),
("InterfaceLib", "PrintDefault") => PpcImportDispatcherTarget::PrintingCompatibility(
PpcPrintingCompatibilityOperation::PrintDefault,
),
(
"InterfaceLib",
"SFindStruct" | "SGetBlock" | "SGetCString" | "SGetSRsrc" | "SGetTypeSRsrc"
| "SNextTypeSRsrc",
) => PpcImportDispatcherTarget::SlotCompatibility,
("InterfaceLib", "CustomGetFile") => PpcImportDispatcherTarget::StandardFileCompatibility(
PpcStandardFileOperation::CustomGetFile,
),
("InterfaceLib", "CustomPutFile") => PpcImportDispatcherTarget::StandardFileCompatibility(
PpcStandardFileOperation::CustomPutFile,
),
("InterfaceLib", "SFGetFile") => PpcImportDispatcherTarget::StandardFileCompatibility(
PpcStandardFileOperation::SfGetFile,
),
("InterfaceLib", "SFPGetFile") => PpcImportDispatcherTarget::StandardFileCompatibility(
PpcStandardFileOperation::SfpGetFile,
),
("InterfaceLib", "SFPPutFile") => PpcImportDispatcherTarget::StandardFileCompatibility(
PpcStandardFileOperation::SfpPutFile,
),
("InterfaceLib", "SFPutFile") => PpcImportDispatcherTarget::StandardFileCompatibility(
PpcStandardFileOperation::SfPutFile,
),
("InterfaceLib", "StandardPutFile") => {
PpcImportDispatcherTarget::StandardFileCompatibility(
PpcStandardFileOperation::StandardPutFile,
)
}
("InterfaceLib", "SPBCloseDevice") => {
PpcImportDispatcherTarget::SoundInputCompatibility(
PpcSoundInputCompatibilityOperation::CloseDevice,
)
}
("InterfaceLib", "SPBGetDeviceInfo") => {
PpcImportDispatcherTarget::SoundInputCompatibility(
PpcSoundInputCompatibilityOperation::GetDeviceInfo,
)
}
("InterfaceLib", "SPBOpenDevice") => {
PpcImportDispatcherTarget::SoundInputCompatibility(
PpcSoundInputCompatibilityOperation::OpenDevice,
)
}
("InterfaceLib", "SPBRecord") => PpcImportDispatcherTarget::SoundInputCompatibility(
PpcSoundInputCompatibilityOperation::Record,
),
("InterfaceLib", "SPBSetDeviceInfo") => {
PpcImportDispatcherTarget::SoundInputCompatibility(
PpcSoundInputCompatibilityOperation::SetDeviceInfo,
)
}
("InterfaceLib", "SPBStopRecording") => {
PpcImportDispatcherTarget::SoundInputCompatibility(
PpcSoundInputCompatibilityOperation::StopRecording,
)
}
("SpeechLib", "CountVoices") => PpcImportDispatcherTarget::SpeechCompatibility(
PpcSpeechCompatibilityOperation::CountVoices,
),
("SpeechLib", "DisposeSpeechChannel") => {
PpcImportDispatcherTarget::SpeechCompatibility(
PpcSpeechCompatibilityOperation::DisposeSpeechChannel,
)
}
("SpeechLib", "GetIndVoice") => PpcImportDispatcherTarget::SpeechCompatibility(
PpcSpeechCompatibilityOperation::GetIndVoice,
),
("SpeechLib", "GetVoiceDescription") => {
PpcImportDispatcherTarget::SpeechCompatibility(
PpcSpeechCompatibilityOperation::GetVoiceDescription,
)
}
("SpeechLib", "NewSpeechChannel") => {
PpcImportDispatcherTarget::SpeechCompatibility(
PpcSpeechCompatibilityOperation::NewSpeechChannel,
)
}
("SpeechLib", "SpeakString") => PpcImportDispatcherTarget::SpeechCompatibility(
PpcSpeechCompatibilityOperation::SpeakString,
),
("SpeechLib", "SpeakText") => PpcImportDispatcherTarget::SpeechCompatibility(
PpcSpeechCompatibilityOperation::SpeakText,
),
("SpeechLib", "SpeechBusy") => PpcImportDispatcherTarget::SpeechCompatibility(
PpcSpeechCompatibilityOperation::SpeechBusy,
),
("QuickTimeLib", "GetMovieTimeBase") => {
PpcImportDispatcherTarget::QuickTimeCompatibility(
PpcQuickTimeCompatibilityOperation::GetMovieTimeBase,
)
}
("QuickTimeLib", "GetMovieVolume") => {
PpcImportDispatcherTarget::QuickTimeCompatibility(
PpcQuickTimeCompatibilityOperation::GetMovieVolume,
)
}
("QuickTimeLib", "NewMovieFromDataFork") => {
PpcImportDispatcherTarget::QuickTimeCompatibility(
PpcQuickTimeCompatibilityOperation::NewMovieFromDataFork,
)
}
("QuickTimeLib", "PrerollMovie") => {
PpcImportDispatcherTarget::QuickTimeCompatibility(
PpcQuickTimeCompatibilityOperation::PrerollMovie,
)
}
("QuickTimeLib", "SetMovieVolume") => {
PpcImportDispatcherTarget::QuickTimeCompatibility(
PpcQuickTimeCompatibilityOperation::SetMovieVolume,
)
}
("QuickTimeLib", "SetTimeBaseFlags") => {
PpcImportDispatcherTarget::QuickTimeCompatibility(
PpcQuickTimeCompatibilityOperation::SetTimeBaseFlags,
)
}
("QuickTimeLib", "UpdateMovie") => {
PpcImportDispatcherTarget::QuickTimeCompatibility(
PpcQuickTimeCompatibilityOperation::UpdateMovie,
)
}
("InputSprocketLib", "ISpDevices_ActivateClass") => {
PpcImportDispatcherTarget::InputSprocketCompatibility(
PpcInputSprocketCompatibilityOperation::DevicesActivateClass,
)
}
("InputSprocketLib", "ISpDevices_DeactivateClass") => {
PpcImportDispatcherTarget::InputSprocketCompatibility(
PpcInputSprocketCompatibilityOperation::DevicesDeactivateClass,
)
}
("InputSprocketLib", "ISpElement_DisposeVirtual") => {
PpcImportDispatcherTarget::InputSprocketCompatibility(
PpcInputSprocketCompatibilityOperation::ElementDisposeVirtual,
)
}
("InputSprocketLib", "ISpElement_Flush") => {
PpcImportDispatcherTarget::InputSprocketCompatibility(
PpcInputSprocketCompatibilityOperation::ElementFlush,
)
}
("InputSprocketLib", "ISpElement_GetNextEvent") => {
PpcImportDispatcherTarget::InputSprocketCompatibility(
PpcInputSprocketCompatibilityOperation::ElementGetNextEvent,
)
}
("InputSprocketLib", "ISpTickle") => {
PpcImportDispatcherTarget::InputSprocketCompatibility(
PpcInputSprocketCompatibilityOperation::Tickle,
)
}
("MathLib", "dec2num") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::Dec2Num,
),
("MathLib", "dec2str") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::Dec2Str,
),
("MathLib", "feclearexcept") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::FeClearExcept,
),
("MathLib", "fetestexcept") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::FeTestExcept,
),
("MathLib", "floor") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::Floor,
),
("MathLib", "ldexp") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::Ldexp,
),
("MathLib", "ldtox80") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::LdToX80,
),
("MathLib", "modf") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::Modf,
),
("MathLib", "num2dec") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::Num2Dec,
),
("MathLib", "str2dec") => PpcImportDispatcherTarget::MathCompatibility(
PpcMathCompatibilityOperation::Str2Dec,
),
("StdCLib", "qsort") => PpcImportDispatcherTarget::StdCCompatibility(
PpcStdCCompatibilityOperation::Qsort,
),
("StdCLib", "signal") => PpcImportDispatcherTarget::StdCCompatibility(
PpcStdCCompatibilityOperation::Signal,
),
("StdCLib", "sscanf") => PpcImportDispatcherTarget::StdCCompatibility(
PpcStdCCompatibilityOperation::Sscanf,
),
("StdCLib", "strftime") => PpcImportDispatcherTarget::StdCCompatibility(
PpcStdCCompatibilityOperation::Strftime,
),
("StdCLib", "vsprintf") => PpcImportDispatcherTarget::StdCCompatibility(
PpcStdCCompatibilityOperation::Vsprintf,
),
("ObjectSupportLib", "CreateObjSpecifier") => {
PpcImportDispatcherTarget::ObjectSupportCompatibility
}
_ => PpcImportDispatcherTarget::Unsupported,
}
}
struct PpcDispatchContext<'a> {
binding: &'a PpcImportBinding,
cpu: &'a mut PpcCpu,
memory: &'a mut PpcSectionMem,
process_memory_manager: &'a mut ProcessNativeMemoryManager,
heap_cursor: &'a mut u32,
heap_limit: u32,
native_heap_ceiling: u32,
last_mem_error: &'a mut i16,
tick_count: &'a mut u32,
cycles_per_tick: u32,
current_resource_refnum: &'a mut i16,
last_resource_error: &'a mut i16,
resource_policy: &'a SharedProcessResourcePolicy,
native_exception_handler: &'a Cell<u32>,
stdc_qsort_stack: &'a mut Vec<PpcQsortState>,
dialog_callback_stack: &'a mut Vec<PpcDialogCallbackState>,
collection_callback_stack: &'a mut Vec<PpcCollectionCallbackState>,
apple_events: &'a mut PpcAppleEventState,
cfm_connections: &'a mut Vec<PpcCfmConnection>,
cfm_library_fragments: &'a mut Vec<PpcCfmLibraryFragment>,
next_cfm_connection_id: &'a mut u32,
import_run_state: &'a mut PpcImportRunState,
controls: &'a mut Vec<PpcControlRecord>,
aliases: &'a mut Vec<PpcAliasRecord>,
gworlds: &'a mut Vec<PpcGWorldRecord>,
gworld_pixel_states: &'a SharedProcessQuickDrawPixelStates,
window_list: &'a SharedProcessWindowList,
q3_objects: &'a mut Vec<PpcQ3ObjectRecord>,
q3_object_refs: &'a mut Vec<PpcQ3ObjectReferenceRecord>,
next_q3_object: &'a mut u32,
q3_error_state: &'a mut PpcQ3ErrorState,
q3_lifecycle: &'a mut PpcQ3LifecycleState,
q3_memory_storages: &'a mut Vec<PpcQ3MemoryStorageRecord>,
q3_files: &'a mut Vec<PpcQ3FileRecord>,
q3_group_memberships: &'a mut Vec<PpcQ3GroupMembershipRecord>,
q3_file_groups: &'a mut Vec<PpcQ3FileGroupRecord>,
q3_views: &'a mut Vec<PpcQ3ViewStateRecord>,
q3_submissions: &'a mut Vec<PpcQ3SubmissionRecord>,
q3_view_transforms: &'a mut Vec<PpcQ3ViewTransformRecord>,
q3_submission_transforms: &'a mut Vec<PpcQ3SubmissionTransformRecord>,
q3_view_materials: &'a mut Vec<PpcQ3ViewMaterialRecord>,
q3_submission_materials: &'a mut Vec<PpcQ3SubmissionMaterialRecord>,
q3_submission_lights: &'a mut Vec<PpcQ3SubmissionLightRecord>,
q3_view_state_stack: &'a mut Vec<PpcQ3ViewStateSnapshotRecord>,
q3_completed_frames: &'a mut Vec<PpcQ3CompletedFrameRecord>,
q3_retained_frames: &'a mut Vec<PpcQ3RetainedFrameRecord>,
q3_state_only_completed_frame_batches: &'a mut Vec<PpcQ3StateOnlyCompletedFrameBatch>,
q3_fog_styles: &'a mut Vec<PpcQ3FogStyleRecord>,
q3_attributes: &'a mut Vec<PpcQ3AttributeRecord>,
q3_shader_uv_transforms: &'a mut Vec<PpcQ3ShaderUvTransformRecord>,
q3_shader_boundaries: &'a mut Vec<PpcQ3ShaderBoundaryRecord>,
q3_mipmap_textures: &'a mut Vec<PpcQ3MipmapTextureRecord>,
q3_texture_shaders: &'a mut Vec<PpcQ3TextureShaderRecord>,
q3_renderer_preferences: &'a mut Vec<PpcQ3RendererPreferenceRecord>,
q3_draw_contexts: &'a mut Vec<PpcQ3DrawContextRecord>,
q3_trimeshes: &'a mut Vec<PpcQ3TriMeshRecord>,
q3_styles: &'a mut Vec<PpcQ3StyleRecord>,
q3_cameras: &'a mut Vec<PpcQ3CameraRecord>,
q3_lights: &'a mut Vec<PpcQ3LightRecord>,
input_sprocket: &'a mut PpcInputSprocketState,
input_sprocket_virtual_elements: &'a mut Vec<PpcInputSprocketVirtualElementRecord>,
toolbox_startup: &'a mut PpcToolboxStartupState,
quicktime: &'a mut PpcQuickTimeState,
sound: &'a mut PpcSoundState,
timer_tasks: &'a SharedProcessTimerTasks,
vbl_tasks: &'a SharedProcessVblTasks,
callback_scheduling: &'a SharedProcessCallbackScheduling,
files: &'a mut Vec<PpcFileRecord>,
writable_refnums: &'a mut HashSet<u16>,
vfs_files: &'a mut ProcessVfsFileRecords,
stdio_streams: &'a mut HashMap<u32, PpcStdioStreamRecord>,
deleted_vfs_file_paths: &'a mut Vec<String>,
resource_files: &'a mut Vec<PpcResourceFileRecord>,
vfs_resource_files: &'a mut ProcessVfsResourceFileRecords,
vfs_resources: &'a mut Vec<PpcVfsResourceRecord>,
next_file_ref_num: &'a mut i16,
current_gworld: &'a mut u32,
current_gdevice: &'a mut u32,
quickdraw_op_colors: &'a SharedProcessQuickDrawOpColors,
quickdraw_hilite_colors: &'a SharedProcessQuickDrawHiliteColors,
screen_clut: &'a mut [[u16; 3]; 256],
color_manager_clut: &'a mut [[u16; 3]; 256],
display_gamma: &'a SharedProcessDisplayGamma,
quickdraw_fore_color: &'a mut PpcRgbColor,
quickdraw_fore_indices: &'a mut HashMap<u32, u8>,
quickdraw_back_color: &'a mut PpcRgbColor,
quickdraw_pen_h: &'a mut i16,
quickdraw_pen_v: &'a mut i16,
quickdraw_text_mode: &'a mut i16,
quickdraw_text_size: &'a mut i16,
cursor_state: &'a SharedProcessCursorState,
vfs_volumes: &'a [PpcVfsVolumeRecord],
vfs_directories: &'a mut Vec<PpcVfsDirectory>,
next_vfs_dir_id: &'a mut u32,
default_dir_id: u32,
working_directories: &'a mut HashMap<i16, ProcessWorkingDirectory>,
next_working_directory_ref_num: &'a mut i16,
application_working_directory_ref_num: &'a mut i16,
launched_app_path: Option<&'a str>,
param_text: &'a SharedProcessDialogText,
scrap: &'a mut PpcScrapState,
list_manager: &'a mut ProcessListManagerState,
collections: &'a SharedProcessCollectionManager,
input: PpcInputSnapshot,
event_queue: &'a mut EventQueue,
draw_sprocket: &'a mut PpcDrawSprocketState,
}
fn dispatch_supported_import(context: PpcDispatchContext<'_>) -> Option<PpcImportAction> {
let PpcDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
native_heap_ceiling,
last_mem_error,
tick_count,
cycles_per_tick,
current_resource_refnum,
last_resource_error,
resource_policy,
native_exception_handler,
stdc_qsort_stack,
dialog_callback_stack,
collection_callback_stack,
apple_events,
cfm_connections,
cfm_library_fragments,
next_cfm_connection_id,
import_run_state,
controls,
aliases,
gworlds,
gworld_pixel_states,
window_list,
q3_objects,
q3_object_refs,
next_q3_object,
q3_error_state,
q3_lifecycle,
q3_memory_storages,
q3_files,
q3_group_memberships,
q3_file_groups,
q3_views,
q3_submissions,
q3_view_transforms,
q3_submission_transforms,
q3_view_materials,
q3_submission_materials,
q3_submission_lights,
q3_view_state_stack,
q3_completed_frames,
q3_retained_frames,
q3_state_only_completed_frame_batches,
q3_fog_styles,
q3_attributes,
q3_shader_uv_transforms,
q3_shader_boundaries,
q3_mipmap_textures,
q3_texture_shaders,
q3_renderer_preferences,
q3_draw_contexts,
q3_trimeshes,
q3_styles,
q3_cameras,
q3_lights,
input_sprocket,
input_sprocket_virtual_elements,
toolbox_startup,
quicktime,
sound,
timer_tasks,
vbl_tasks,
callback_scheduling,
files,
writable_refnums,
vfs_files,
stdio_streams,
deleted_vfs_file_paths,
resource_files,
vfs_resource_files,
vfs_resources,
next_file_ref_num,
current_gworld,
current_gdevice,
quickdraw_op_colors,
quickdraw_hilite_colors,
screen_clut,
color_manager_clut,
display_gamma,
quickdraw_fore_color,
quickdraw_fore_indices,
quickdraw_back_color,
quickdraw_pen_h,
quickdraw_pen_v,
quickdraw_text_mode,
quickdraw_text_size,
cursor_state,
vfs_volumes,
vfs_directories,
next_vfs_dir_id,
default_dir_id,
working_directories,
next_working_directory_ref_num,
application_working_directory_ref_num,
launched_app_path,
param_text,
scrap,
list_manager,
collections,
input,
event_queue,
draw_sprocket,
} = context;
let _menu_root = (matches!(
binding.dispatcher_target,
PpcImportDispatcherTarget::MenuSelect | PpcImportDispatcherTarget::PopUpMenuSelect
))
.then(|| {
let call = match binding.dispatcher_target {
PpcImportDispatcherTarget::PopUpMenuSelect => ppc_popup_menu_call(cpu),
_ => ppc_menu_select_call(cpu, cpu.gpr[3]),
};
toolbox_startup.execution.enter_menu_call(call)
});
ppc_sync_gworld_pixel_state_mirrors(gworlds, gworld_pixel_states);
let handles = &mut process_memory_manager.native_handle_records().to_vec();
if is_quickdraw_3d_library(&binding.library_name)
&& !matches!(
binding.dispatcher_target,
PpcImportDispatcherTarget::Q3ErrorGet
)
&& q3_error_state.clear_on_next_q3_call
{
q3_error_state.clear();
}
if let Some(action) = dispatch_qd3d::dispatch_q3_core_import(
dispatch_qd3d::PpcQ3CoreDispatchContext {
target: &binding.dispatcher_target,
cpu,
memory,
q3_objects,
next_q3_object,
q3_error_state,
q3_lifecycle,
},
) {
return Some(action);
}
if let Some(action) = dispatch_qd3d::dispatch_q3_storage_file_import(
dispatch_qd3d::PpcQ3StorageFileDispatchContext {
target: &binding.dispatcher_target,
cpu,
process_memory_manager,
memory,
stores: PpcQ3ObjectStores {
q3_objects,
q3_object_refs,
q3_renderer_preferences,
q3_files,
q3_group_memberships,
q3_file_groups,
q3_views,
q3_submissions,
q3_view_transforms,
q3_submission_transforms,
q3_view_materials,
q3_submission_materials,
q3_submission_lights,
q3_view_state_stack,
q3_completed_frames,
q3_retained_frames,
q3_fog_styles,
q3_memory_storages,
q3_attributes,
q3_shader_uv_transforms,
q3_shader_boundaries,
q3_mipmap_textures,
q3_texture_shaders,
q3_draw_contexts,
q3_trimeshes,
q3_styles,
q3_cameras,
q3_lights,
},
next_q3_object,
q3_error_state,
heap_cursor,
heap_limit,
last_mem_error,
vfs_directories,
vfs_files,
},
) {
return Some(action);
}
if let Some(action) = dispatch_qd3d::dispatch_q3_geometry_import(
dispatch_qd3d::PpcQ3GeometryDispatchContext {
target: &binding.dispatcher_target,
cpu,
process_memory_manager,
memory,
stores: PpcQ3ObjectStores {
q3_objects,
q3_object_refs,
q3_renderer_preferences,
q3_files,
q3_group_memberships,
q3_file_groups,
q3_views,
q3_submissions,
q3_view_transforms,
q3_submission_transforms,
q3_view_materials,
q3_submission_materials,
q3_submission_lights,
q3_view_state_stack,
q3_completed_frames,
q3_retained_frames,
q3_fog_styles,
q3_memory_storages,
q3_attributes,
q3_shader_uv_transforms,
q3_shader_boundaries,
q3_mipmap_textures,
q3_texture_shaders,
q3_draw_contexts,
q3_trimeshes,
q3_styles,
q3_cameras,
q3_lights,
},
next_q3_object,
q3_error_state,
heap_cursor,
last_mem_error,
gworlds,
},
) {
return Some(action);
}
if let Some(action) = dispatch_qd3d::dispatch_q3_group_view_import(
dispatch_qd3d::PpcQ3GroupViewDispatchContext {
target: &binding.dispatcher_target,
cpu,
memory,
stores: PpcQ3ObjectStores {
q3_objects,
q3_object_refs,
q3_renderer_preferences,
q3_files,
q3_group_memberships,
q3_file_groups,
q3_views,
q3_submissions,
q3_view_transforms,
q3_submission_transforms,
q3_view_materials,
q3_submission_materials,
q3_submission_lights,
q3_view_state_stack,
q3_completed_frames,
q3_retained_frames,
q3_fog_styles,
q3_memory_storages,
q3_attributes,
q3_shader_uv_transforms,
q3_shader_boundaries,
q3_mipmap_textures,
q3_texture_shaders,
q3_draw_contexts,
q3_trimeshes,
q3_styles,
q3_cameras,
q3_lights,
},
next_q3_object,
q3_state_only_completed_frame_batches,
gworlds,
current_gworld: *current_gworld,
q3_error_state,
input_idle: input.is_idle(),
},
) {
return Some(action);
}
let mut current_menu_list = ppc_current_menu_list(memory);
if let Some(action) = dispatch_cfm::dispatch_cfm_import(dispatch_cfm::PpcCfmDispatchContext {
binding,
cpu,
guest_calls: &toolbox_startup.execution.calls(),
process_memory_manager,
memory,
heap_cursor,
heap_limit,
cfm_connections,
cfm_library_fragments,
vfs_files,
vfs_resource_files,
vfs_directories,
next_cfm_connection_id,
import_run_state,
}) {
return Some(action);
}
if let Some(action) = dispatch_files::dispatch_file_import(
dispatch_files::PpcFileDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
last_mem_error,
handles,
aliases,
files,
writable_refnums,
vfs_files,
vfs_directories,
next_vfs_dir_id,
deleted_vfs_file_paths,
vfs_resource_files,
resource_files,
vfs_resources,
next_file_ref_num,
current_resource_refnum,
last_resource_error,
default_dir_id,
launched_app_path,
vfs_volumes,
working_directories,
next_working_directory_ref_num,
application_working_directory_ref_num,
},
) {
return Some(action);
}
if let Some(action) = dispatch_resources::dispatch_resource_import(
dispatch_resources::PpcResourceDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
resource_files,
vfs_resource_files,
vfs_resources,
current_resource_refnum,
resource_policy,
last_resource_error,
},
) {
return Some(action);
}
if let Some(action) = dispatch_icon_services::dispatch_icon_services_import(
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
last_mem_error,
&mut toolbox_startup.icon_refs,
vfs_directories,
vfs_files,
vfs_resource_files,
vfs_resources,
gworlds,
*current_gworld,
) {
return Some(action);
}
if let Some(action) = dispatch_stdc::dispatch_stdc_import(
dispatch_stdc::PpcStdCDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
last_mem_error,
stdc_qsort_stack,
stdc_signal_state: &mut toolbox_startup.stdc_signal_state,
},
) {
return Some(action);
}
if let Some(action) = dispatch_core_foundation::dispatch_core_foundation_import(
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
last_mem_error,
toolbox_startup,
) {
return Some(action);
}
if let Some(action) = dispatch_regions::dispatch_region_import(
dispatch_regions::PpcRegionDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
current_gworld: *current_gworld,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_polygons::dispatch_polygon_import(
dispatch_polygons::PpcPolygonDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
gworlds,
current_gworld: *current_gworld,
quickdraw_fore_color,
quickdraw_fore_indices,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_bit_transfers::dispatch_bit_transfer_import(
dispatch_bit_transfers::PpcBitTransferDispatchContext {
binding,
cpu,
memory,
gworlds,
window_list,
current_gworld: *current_gworld,
current_gdevice: *current_gdevice,
quickdraw_op_colors,
color_manager_clut,
quickdraw_fore_color: *quickdraw_fore_color,
quickdraw_fore_index: quickdraw_fore_indices.get(current_gworld).copied(),
quickdraw_back_color: *quickdraw_back_color,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_graphics_devices::dispatch_graphics_device_import(
dispatch_graphics_devices::PpcGraphicsDeviceDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
gworlds,
current_gdevice,
toolbox_startup,
screen_clut,
color_manager_clut,
},
) {
return Some(action);
}
if let Some(action) = dispatch_color_tables::dispatch_color_table_import(
dispatch_color_tables::PpcColorTableDispatchContext {
binding,
cpu,
process_memory_manager,
memory,
heap_cursor,
heap_limit,
last_mem_error,
handles,
vfs_resources,
current_resource_refnum,
current_gworld,
quickdraw_hilite_colors,
tick_count,
current_gdevice,
screen_clut,
color_manager_clut,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_palettes::dispatch_palette_import(
dispatch_palettes::PpcPaletteDispatchContext {
binding,
cpu,
memory,
gworlds,
window_list,
current_gdevice: *current_gdevice,
screen_clut,
color_manager_clut,
toolbox_startup,
event_queue,
tick_count: *tick_count,
input,
},
) {
return Some(action);
}
if let Some(action) = dispatch_gworlds::dispatch_gworld_import(
dispatch_gworlds::PpcGWorldDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
gworlds,
gworld_pixel_states,
current_gworld,
current_gdevice,
quickdraw_op_colors,
quickdraw_hilite_colors,
quickdraw_fore_color,
quickdraw_fore_indices,
quickdraw_back_color,
quickdraw_pen_h,
quickdraw_pen_v,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_quickdraw::dispatch_quickdraw_import(
dispatch_quickdraw::PpcQuickDrawDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
last_mem_error,
handles,
gworlds,
tick_count: *tick_count,
current_gworld: *current_gworld,
current_gdevice: *current_gdevice,
quickdraw_op_colors,
quickdraw_hilite_colors,
screen_clut,
color_manager_clut,
quickdraw_fore_color,
quickdraw_fore_indices,
quickdraw_back_color,
quickdraw_pen_h,
quickdraw_pen_v,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_picture::dispatch_picture_import(
dispatch_picture::PpcPictureDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
vfs_resources,
gworlds,
current_gworld: *current_gworld,
screen_clut,
color_manager_clut,
},
) {
return Some(action);
}
if let Some(action) = dispatch_fonts::dispatch_font_import(
dispatch_fonts::PpcFontDispatchContext {
binding,
cpu,
memory,
toolbox_startup,
gworlds,
current_gworld: *current_gworld,
quickdraw_text_mode,
quickdraw_text_size,
quickdraw_fore_color,
quickdraw_fore_indices,
quickdraw_pen_h,
quickdraw_pen_v,
vfs_resources,
},
) {
return Some(action);
}
if let Some(action) = dispatch_sound::dispatch_sound_import(
dispatch_sound::PpcSoundDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
last_mem_error,
current_resource_refnum: *current_resource_refnum,
handles,
files,
vfs_files,
vfs_resources,
sound,
},
) {
return Some(action);
}
if let Some(action) = dispatch_event::dispatch_time_import(
dispatch_event::PpcTimeDispatchContext {
target: &binding.dispatcher_target,
cpu,
memory,
tick_count: *tick_count,
cycles_per_tick,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_event::dispatch_event_import(
dispatch_event::PpcEventDispatchContext {
binding,
cpu,
memory,
handles,
gworlds,
current_gworld: *current_gworld,
current_menu_list,
screen_clut,
toolbox_startup,
apple_events,
event_queue,
input,
tick_count: *tick_count,
},
) {
return Some(action);
}
if let Some(action) = dispatch_low_memory::dispatch_low_memory_import(
dispatch_low_memory::PpcLowMemoryDispatchContext {
target: &binding.dispatcher_target,
cpu,
memory,
current_menu_list,
default_dir_id,
},
) {
return Some(action);
}
if let Some(action) =
dispatch_math::dispatch_math_import(&binding.dispatcher_target, cpu, memory)
{
return Some(action);
}
if let Some(action) = dispatch_toolbox::dispatch_toolbox_import(
dispatch_toolbox::PpcToolboxDispatchContext {
binding,
cpu,
memory,
},
) {
return Some(action);
}
if let Some(action) = dispatch_memory::dispatch_memory_import(
dispatch_memory::PpcMemoryDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
native_heap_ceiling,
last_mem_error,
handles,
aliases,
vfs_resources,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_menu::dispatch_menu_import(
dispatch_menu::PpcMenuDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
last_resource_error,
handles,
vfs_resources,
current_resource_refnum: *current_resource_refnum,
resource_policy,
toolbox_startup,
current_menu_list: &mut current_menu_list,
gworlds,
screen_clut,
current_gworld,
current_gdevice,
event_queue,
input,
},
) {
return Some(action);
}
if let Some(action) = dispatch_threads::dispatch_thread_import(
dispatch_threads::PpcThreadDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_textedit::dispatch_textedit_import(
dispatch_textedit::PpcTextEditDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
toolbox_startup,
current_gworld: *current_gworld,
tick_count: *tick_count,
quickdraw_text_mode: *quickdraw_text_mode,
quickdraw_text_size: *quickdraw_text_size,
quickdraw_fore_color,
quickdraw_back_color,
quickdraw_fore_indices,
scrap,
gworlds,
input,
event_queue,
},
) {
return Some(action);
}
let screen_bits = ppc_screen_bits_addr(toolbox_startup.init_graf_global_ptr)
.filter(|ptr| *ptr != 0 && ppc_memory_can_write_bytes(memory, *ptr, 14));
if let Some(action) = dispatch_drawsprocket::dispatch_drawsprocket_import(
dispatch_drawsprocket::PpcDrawSprocketDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
gworlds,
gworld_allocations: &mut toolbox_startup.gworld_allocations,
current_gdevice: *current_gdevice,
draw_sprocket,
input,
screen_clut,
screen_bits,
},
) {
return Some(action);
}
if let Some(action) = dispatch_inputsprocket::dispatch_inputsprocket_import(
dispatch_inputsprocket::PpcInputSprocketDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
input_sprocket,
input_sprocket_virtual_elements,
input,
tick_count: *tick_count,
vfs_resources,
current_resource_refnum: *current_resource_refnum,
},
) {
return Some(action);
}
if let Some(action) = dispatch_quicktime::dispatch_quicktime_import(
dispatch_quicktime::PpcQuickTimeDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
last_mem_error,
handles,
vfs_directories,
vfs_files,
vfs_resource_files,
vfs_resources,
gworlds,
current_gworld: *current_gworld,
quicktime,
sound,
},
) {
return Some(action);
}
if let Some(action) = dispatch_time::dispatch_time_import(
dispatch_time::PpcTimeDispatchContext {
binding,
cpu,
memory,
timer_tasks,
vbl_tasks,
callback_scheduling,
tick_count: *tick_count,
},
) {
return Some(action);
}
if let Some(action) = dispatch_standard_file::dispatch_standard_file_import(
dispatch_standard_file::PpcStandardFileDispatchContext {
binding,
cpu,
memory,
startup: toolbox_startup,
process_memory_manager,
heap_cursor,
last_mem_error,
gworlds,
vfs_directories,
vfs_files,
vfs_resource_files,
vfs_volumes,
default_dir_id,
working_directories,
next_working_directory_ref_num,
event_queue,
},
) {
return Some(action);
}
if let Some(action) = dispatch_control::dispatch_control_import(
dispatch_control::PpcControlDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
controls,
gworlds,
screen_clut,
current_gworld: *current_gworld,
toolbox_startup,
input,
vfs_resources,
current_resource_refnum: *current_resource_refnum,
last_resource_error,
},
) {
return Some(action);
}
if let Some(action) = dispatch_list::dispatch_list_import(
dispatch_list::PpcListDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
controls,
list_manager,
gworlds,
vfs_resources,
current_resource_refnum: *current_resource_refnum,
tick_count: *tick_count,
},
) {
return Some(action);
}
if let Some(action) = dispatch_collection::dispatch_collection_import(
dispatch_collection::PpcCollectionDispatchContext {
binding,
cpu,
memory,
heap_cursor,
heap_limit,
last_mem_error,
handles,
collections,
callback_stack: collection_callback_stack,
},
) {
return Some(action);
}
if let Some(action) = dispatch_appearance::dispatch_appearance_import(
binding,
cpu,
memory,
handles,
controls,
gworlds,
vfs_resources,
*current_resource_refnum,
) {
return Some(action);
}
if let Some(action) = dispatch_dialog::dispatch_dialog_import(
dispatch_dialog::PpcDialogDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
controls,
gworlds,
screen_clut,
color_manager_clut,
current_gworld,
current_gdevice,
window_list,
toolbox_startup,
event_queue,
dialog_callback_stack,
vfs_resources,
current_resource_refnum: *current_resource_refnum,
last_resource_error,
param_text,
tick_count: *tick_count,
input,
quickdraw_text_mode: *quickdraw_text_mode,
quickdraw_text_size: *quickdraw_text_size,
quickdraw_fore_color,
quickdraw_back_color,
quickdraw_fore_indices,
},
) {
return Some(action);
}
if let Some(action) = dispatch_window::dispatch_window_import(
dispatch_window::PpcWindowDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
controls,
gworlds,
window_list,
draw_sprocket,
current_gworld,
current_gdevice,
quickdraw_fore_color,
quickdraw_fore_indices,
quickdraw_back_color,
screen_clut,
color_manager_clut,
toolbox_startup,
input,
tick_count: *tick_count,
event_queue,
vfs_resources,
current_resource_refnum: *current_resource_refnum,
last_resource_error,
},
) {
return Some(action);
}
if let Some(action) = dispatch_display::dispatch_display_import(
dispatch_display::PpcDisplayDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
gworlds,
toolbox_startup,
screen_clut,
color_manager_clut,
},
) {
return Some(action);
}
if let Some(action) = dispatch_devices::dispatch_device_import(
dispatch_devices::PpcDeviceDispatchContext {
binding,
cpu,
memory,
current_gdevice: *current_gdevice,
screen_clut,
display_gamma,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_desk::dispatch_desk_import(
dispatch_desk::PpcDeskDispatchContext { binding },
) {
return Some(action);
}
if let Some(action) = dispatch_gestalt::dispatch_gestalt_import(
dispatch_gestalt::PpcGestaltDispatchContext {
binding,
cpu,
memory,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_cursor::dispatch_cursor_import(
dispatch_cursor::PpcCursorDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
vfs_resources,
current_resource_refnum: *current_resource_refnum,
last_resource_error,
cursor_state,
gworlds,
current_gworld: *current_gworld,
screen_clut,
},
) {
return Some(action);
}
if let Some(action) = dispatch_apple_events::dispatch_apple_event_import(
dispatch_apple_events::PpcAppleEventDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
apple_events,
toolbox_startup,
},
) {
return Some(action);
}
if let Some(action) = dispatch_process::dispatch_process_import(
dispatch_process::PpcProcessDispatchContext {
binding,
cpu,
memory,
vfs_directories,
vfs_files,
vfs_resource_files,
launched_app_path,
},
) {
return Some(action);
}
if let Some(action) = dispatch_scrap::dispatch_scrap_import(
dispatch_scrap::PpcScrapDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
handles,
scrap,
},
) {
return Some(action);
}
if let Some(action) = dispatch_mixed_mode::dispatch_mixed_mode_import(
dispatch_mixed_mode::PpcMixedModeDispatchContext {
binding,
cpu,
memory,
process_memory_manager,
heap_cursor,
heap_limit,
last_mem_error,
toolbox_startup,
cfm_connections,
next_cfm_connection_id,
import_run_state,
},
) {
return action;
}
if let Some(action) = dispatch_native_exceptions::dispatch_native_exception_import(
dispatch_native_exceptions::PpcNativeExceptionDispatchContext {
binding,
cpu,
native_exception_handler,
},
) {
return Some(action);
}
match binding.dispatcher_target {
PpcImportDispatcherTarget::Collection(_) => {
unreachable!("collection imports return through dispatch_collection_import")
}
PpcImportDispatcherTarget::InstallExceptionHandler => {
unreachable!(
"native exception imports return through dispatch_native_exception_import"
)
}
PpcImportDispatcherTarget::RegisterAppearanceClient
| PpcImportDispatcherTarget::ActivateControl
| PpcImportDispatcherTarget::DeactivateControl
| PpcImportDispatcherTarget::IsControlActive
| PpcImportDispatcherTarget::CollapseWindow
| PpcImportDispatcherTarget::IsWindowCollapsed
| PpcImportDispatcherTarget::UnregisterAppearanceClient
| PpcImportDispatcherTarget::SetControlFontStyle => {
unreachable!("appearance imports return through dispatch_appearance_import")
}
PpcImportDispatcherTarget::NewPtr { .. }
| PpcImportDispatcherTarget::DisposePtr
| PpcImportDispatcherTarget::GetPtrSize
| PpcImportDispatcherTarget::SetPtrSize
| PpcImportDispatcherTarget::RecoverHandle
| PpcImportDispatcherTarget::BlockMove
| PpcImportDispatcherTarget::BlockZero
| PpcImportDispatcherTarget::PtrToHand
| PpcImportDispatcherTarget::PtrToXHand
| PpcImportDispatcherTarget::HandToHand
| PpcImportDispatcherTarget::HandAndHand
| PpcImportDispatcherTarget::NewHandle { .. }
| PpcImportDispatcherTarget::TempNewHandle
| PpcImportDispatcherTarget::TempDisposeHandle
| PpcImportDispatcherTarget::HoldMemory
| PpcImportDispatcherTarget::UnholdMemory
| PpcImportDispatcherTarget::DisposeHandle
| PpcImportDispatcherTarget::EmptyHandle
| PpcImportDispatcherTarget::GetHandleSize
| PpcImportDispatcherTarget::SetHandleSize
| PpcImportDispatcherTarget::HLock
| PpcImportDispatcherTarget::HLockHi
| PpcImportDispatcherTarget::HGetState
| PpcImportDispatcherTarget::HSetState
| PpcImportDispatcherTarget::HUnlock
| PpcImportDispatcherTarget::MoveHHi
| PpcImportDispatcherTarget::HNoPurge
| PpcImportDispatcherTarget::HPurge
| PpcImportDispatcherTarget::GetZone
| PpcImportDispatcherTarget::SetZone
| PpcImportDispatcherTarget::InitZone
| PpcImportDispatcherTarget::SystemZone
| PpcImportDispatcherTarget::ApplicationZone
| PpcImportDispatcherTarget::MaxApplZone
| PpcImportDispatcherTarget::MoreMasters
| PpcImportDispatcherTarget::FlushCodeCache
| PpcImportDispatcherTarget::GetApplLimit
| PpcImportDispatcherTarget::SetApplLimit
| PpcImportDispatcherTarget::HeapFreeBytes
| PpcImportDispatcherTarget::MaxMem
| PpcImportDispatcherTarget::PurgeMem
| PpcImportDispatcherTarget::PurgeMemSys
| PpcImportDispatcherTarget::MemError => {
unreachable!("memory imports return through dispatch_memory_import")
}
PpcImportDispatcherTarget::InitMenus
| PpcImportDispatcherTarget::NewMenu
| PpcImportDispatcherTarget::DisposeMenu
| PpcImportDispatcherTarget::GetMenu
| PpcImportDispatcherTarget::GetItemCmd
| PpcImportDispatcherTarget::SetItemCmd
| PpcImportDispatcherTarget::GetItemMark
| PpcImportDispatcherTarget::CountMItems
| PpcImportDispatcherTarget::GetMenuItemText
| PpcImportDispatcherTarget::SetMenuItemText
| PpcImportDispatcherTarget::DeleteMenuItem
| PpcImportDispatcherTarget::CalcMenuSize
| PpcImportDispatcherTarget::PopUpMenuSelect
| PpcImportDispatcherTarget::InsertMenu
| PpcImportDispatcherTarget::DeleteMenu
| PpcImportDispatcherTarget::AppendMenu
| PpcImportDispatcherTarget::InsertMenuItem
| PpcImportDispatcherTarget::AppendResMenu
| PpcImportDispatcherTarget::InsertResMenu
| PpcImportDispatcherTarget::EnableMenuItem
| PpcImportDispatcherTarget::DisableMenuItem
| PpcImportDispatcherTarget::SetItemMark
| PpcImportDispatcherTarget::CheckItem
| PpcImportDispatcherTarget::GetMenuBar
| PpcImportDispatcherTarget::GetNewMBar
| PpcImportDispatcherTarget::ClearMenuBar
| PpcImportDispatcherTarget::SetMenuBar
| PpcImportDispatcherTarget::GetMenuHandle
| PpcImportDispatcherTarget::DrawMenuBar
| PpcImportDispatcherTarget::InvalMenuBar
| PpcImportDispatcherTarget::FlashMenuBar
| PpcImportDispatcherTarget::HMGetHelpMenuHandle
| PpcImportDispatcherTarget::HMGetBalloons
| PpcImportDispatcherTarget::HiliteMenu
| PpcImportDispatcherTarget::MenuNoop
| PpcImportDispatcherTarget::MenuKey
| PpcImportDispatcherTarget::MenuEvent
| PpcImportDispatcherTarget::MenuChoice
| PpcImportDispatcherTarget::GetMBarHeight
| PpcImportDispatcherTarget::SetMBarHeight
| PpcImportDispatcherTarget::MenuSelect => {
unreachable!("menu imports return through dispatch_menu_import")
}
PpcImportDispatcherTarget::GetCurrentThread
| PpcImportDispatcherTarget::NewThreadEntryUPP
| PpcImportDispatcherTarget::DisposeThreadEntryUPP
| PpcImportDispatcherTarget::NewThreadTerminationUPP
| PpcImportDispatcherTarget::DisposeThreadTerminationUPP
| PpcImportDispatcherTarget::NewThreadSwitchUPP
| PpcImportDispatcherTarget::DisposeThreadSwitchUPP
| PpcImportDispatcherTarget::SetThreadTerminator
| PpcImportDispatcherTarget::SetThreadSwitcher
| PpcImportDispatcherTarget::GetThreadState
| PpcImportDispatcherTarget::GetThreadCurrentTaskRef
| PpcImportDispatcherTarget::GetThreadStateGivenTaskRef
| PpcImportDispatcherTarget::SetThreadReadyGivenTaskRef
| PpcImportDispatcherTarget::SetThreadState
| PpcImportDispatcherTarget::SetThreadStateEndCritical
| PpcImportDispatcherTarget::CreateThreadPool
| PpcImportDispatcherTarget::GetFreeThreadCount
| PpcImportDispatcherTarget::GetSpecificFreeThreadCount
| PpcImportDispatcherTarget::GetDefaultThreadStackSize
| PpcImportDispatcherTarget::ThreadCurrentStackSpace
| PpcImportDispatcherTarget::NewThread
| PpcImportDispatcherTarget::YieldToThread
| PpcImportDispatcherTarget::YieldToAnyThread
| PpcImportDispatcherTarget::DisposeThread
| PpcImportDispatcherTarget::ThreadBeginCritical
| PpcImportDispatcherTarget::ThreadEndCritical => {
unreachable!("thread imports return through dispatch_thread_import")
}
PpcImportDispatcherTarget::TEInit
| PpcImportDispatcherTarget::TENew
| PpcImportDispatcherTarget::TEStyleNew
| PpcImportDispatcherTarget::TESetStyle
| PpcImportDispatcherTarget::TEUseStyleScrap
| PpcImportDispatcherTarget::TEContinuousStyle
| PpcImportDispatcherTarget::TEGetText
| PpcImportDispatcherTarget::TEDispose
| PpcImportDispatcherTarget::TEActivate { .. }
| PpcImportDispatcherTarget::TESetSelect
| PpcImportDispatcherTarget::TESetText
| PpcImportDispatcherTarget::TECalText
| PpcImportDispatcherTarget::TEInsert { .. }
| PpcImportDispatcherTarget::TEDelete
| PpcImportDispatcherTarget::TEKey
| PpcImportDispatcherTarget::TEClick
| PpcImportDispatcherTarget::TEIdle
| PpcImportDispatcherTarget::TEUpdate
| PpcImportDispatcherTarget::TETextBox
| PpcImportDispatcherTarget::TESetAlignment
| PpcImportDispatcherTarget::TEGetHeight
| PpcImportDispatcherTarget::TEGetPoint
| PpcImportDispatcherTarget::TEScroll { .. }
| PpcImportDispatcherTarget::TEAutoView
| PpcImportDispatcherTarget::TECopy { .. }
| PpcImportDispatcherTarget::TEPaste { .. }
| PpcImportDispatcherTarget::TETransferScrap { .. }
| PpcImportDispatcherTarget::TEScrapHandle
| PpcImportDispatcherTarget::TEScrapLength { .. } => {
unreachable!("textedit imports return through dispatch_textedit_import")
}
PpcImportDispatcherTarget::DSpStartup
| PpcImportDispatcherTarget::DSpGetVersion
| PpcImportDispatcherTarget::DSpShutdown
| PpcImportDispatcherTarget::DSpGetFirstContext
| PpcImportDispatcherTarget::DSpGetNextContext
| PpcImportDispatcherTarget::DSpProcessEvent
| PpcImportDispatcherTarget::DSpBlitFastest
| PpcImportDispatcherTarget::DSpCanUserSelectContext
| PpcImportDispatcherTarget::DSpGetMouse
| PpcImportDispatcherTarget::DSpFindContextFromPoint
| PpcImportDispatcherTarget::DSpContextGlobalToLocal
| PpcImportDispatcherTarget::DSpContextLocalToGlobal
| PpcImportDispatcherTarget::DSpFindBestContext
| PpcImportDispatcherTarget::DSpFindBestContextOnDisplayID
| PpcImportDispatcherTarget::DSpUserSelectContext
| PpcImportDispatcherTarget::DSpSetBlankingColor
| PpcImportDispatcherTarget::DSpAltBufferNew
| PpcImportDispatcherTarget::DSpAltBufferGetCGrafPtr
| PpcImportDispatcherTarget::DSpContextReserve
| PpcImportDispatcherTarget::DSpContextRelease
| PpcImportDispatcherTarget::DSpContextSetState
| PpcImportDispatcherTarget::DSpContextGetState
| PpcImportDispatcherTarget::DSpContextFadeGamma
| PpcImportDispatcherTarget::DSpContextFadeGammaIn
| PpcImportDispatcherTarget::DSpContextFadeGammaOut
| PpcImportDispatcherTarget::DSpContextGetFrontBuffer
| PpcImportDispatcherTarget::DSpContextGetBackBuffer
| PpcImportDispatcherTarget::DSpContextSwapBuffers
| PpcImportDispatcherTarget::DSpContextSetClutEntries
| PpcImportDispatcherTarget::DSpContextGetDisplayID
| PpcImportDispatcherTarget::DSpContextGetAttributes
| PpcImportDispatcherTarget::DSpContextSetVblProc
| PpcImportDispatcherTarget::DSpContextIsBusy
| PpcImportDispatcherTarget::DSpAltBufferDispose
| PpcImportDispatcherTarget::DSpContextInvalBackBufferRect
| PpcImportDispatcherTarget::DSpContextSetUnderlayAltBuffer => {
unreachable!("drawsprocket imports return through dispatch_drawsprocket_import")
}
PpcImportDispatcherTarget::ISpElementNewVirtualFromNeeds
| PpcImportDispatcherTarget::ISpElementListNew
| PpcImportDispatcherTarget::ISpElementListAddElements
| PpcImportDispatcherTarget::ISpElementListGetNextEvent
| PpcImportDispatcherTarget::ISpElementListFlush
| PpcImportDispatcherTarget::ISpDevicesExtract
| PpcImportDispatcherTarget::ISpDevicesExtractByClass
| PpcImportDispatcherTarget::ISpDeviceGetDefinition
| PpcImportDispatcherTarget::ISpDeviceGetElementList
| PpcImportDispatcherTarget::ISpElementListExtract
| PpcImportDispatcherTarget::ISpElementGetInfo
| PpcImportDispatcherTarget::ISpElementGetSimpleState
| PpcImportDispatcherTarget::ISpGetVersion
| PpcImportDispatcherTarget::ISpStartup
| PpcImportDispatcherTarget::ISpShutdown
| PpcImportDispatcherTarget::ISpInit
| PpcImportDispatcherTarget::ISpStop
| PpcImportDispatcherTarget::ISpSuspend
| PpcImportDispatcherTarget::ISpResume
| PpcImportDispatcherTarget::ISpDevicesActivate
| PpcImportDispatcherTarget::ISpDevicesDeactivate
| PpcImportDispatcherTarget::ISpConfigure => {
unreachable!("inputsprocket imports return through dispatch_inputsprocket_import")
}
PpcImportDispatcherTarget::QtEnterMovies
| PpcImportDispatcherTarget::QtExitMovies
| PpcImportDispatcherTarget::QtGetMoviesError
| PpcImportDispatcherTarget::QtGetMoviesStickyError
| PpcImportDispatcherTarget::QtClearMoviesStickyError
| PpcImportDispatcherTarget::QtGetGraphicsImporterForFile
| PpcImportDispatcherTarget::QtOpenADefaultComponent
| PpcImportDispatcherTarget::QtGraphicsImportSetDataHandle
| PpcImportDispatcherTarget::QtGraphicsImportGetImageDescription
| PpcImportDispatcherTarget::QtGraphicsImportGetBoundsRect
| PpcImportDispatcherTarget::QtGraphicsImportSetGWorld
| PpcImportDispatcherTarget::QtGraphicsImportDraw
| PpcImportDispatcherTarget::QtOpenMovieFile
| PpcImportDispatcherTarget::QtNewMovieFromFile
| PpcImportDispatcherTarget::QtGetMovieBox
| PpcImportDispatcherTarget::QtSetMovieBox
| PpcImportDispatcherTarget::QtSetMovieGWorld
| PpcImportDispatcherTarget::QtStartMovie
| PpcImportDispatcherTarget::QtStopMovie
| PpcImportDispatcherTarget::QtMoviesTask
| PpcImportDispatcherTarget::QtDisposeMovie
| PpcImportDispatcherTarget::QtIsMovieDone
| PpcImportDispatcherTarget::QtGoToBeginningOfMovie
| PpcImportDispatcherTarget::QtGoToEndOfMovie
| PpcImportDispatcherTarget::QtGetMovieDuration
| PpcImportDispatcherTarget::QtLoadMovieIntoRam
| PpcImportDispatcherTarget::QtCloseMovieFile => {
unreachable!("quicktime imports return through dispatch_quicktime_import")
}
PpcImportDispatcherTarget::InsTime
| PpcImportDispatcherTarget::InsXTime
| PpcImportDispatcherTarget::PrimeTime
| PpcImportDispatcherTarget::RmvTime
| PpcImportDispatcherTarget::VInstall
| PpcImportDispatcherTarget::VRemove
| PpcImportDispatcherTarget::SlotVInstall
| PpcImportDispatcherTarget::SlotVRemove => {
unreachable!("time and vbl imports return through dispatch_time_import")
}
PpcImportDispatcherTarget::DrawGrowIcon => {
unreachable!("window imports return through dispatch_window_import")
}
PpcImportDispatcherTarget::GetPictInfo
| PpcImportDispatcherTarget::DrawPicture
| PpcImportDispatcherTarget::KillPicture => {
unreachable!("picture imports return through dispatch_picture_import")
}
PpcImportDispatcherTarget::InitCursor
| PpcImportDispatcherTarget::GetQDGlobalsArrow
| PpcImportDispatcherTarget::HideCursor
| PpcImportDispatcherTarget::ShowCursor
| PpcImportDispatcherTarget::ShieldCursor
| PpcImportDispatcherTarget::CrsrDevNextDevice
| PpcImportDispatcherTarget::CrsrDevMoveTo
| PpcImportDispatcherTarget::GetCursor
| PpcImportDispatcherTarget::SetCursor
| PpcImportDispatcherTarget::GetCCursor
| PpcImportDispatcherTarget::SetCCursor
| PpcImportDispatcherTarget::DisposeCCursor
| PpcImportDispatcherTarget::GetCIcon
| PpcImportDispatcherTarget::PlotCIcon
| PpcImportDispatcherTarget::DisposeCIcon => {
unreachable!("cursor and cicon imports return through dispatch_cursor_import")
}
PpcImportDispatcherTarget::FSClose
| PpcImportDispatcherTarget::PBClose
| PpcImportDispatcherTarget::PBFlushFile
| PpcImportDispatcherTarget::FSRead
| PpcImportDispatcherTarget::PBRead
| PpcImportDispatcherTarget::FSWrite
| PpcImportDispatcherTarget::PBWrite
| PpcImportDispatcherTarget::GetEOF
| PpcImportDispatcherTarget::PBGetEOF
| PpcImportDispatcherTarget::SetEOF
| PpcImportDispatcherTarget::AllocContig
| PpcImportDispatcherTarget::PBSetEOF
| PpcImportDispatcherTarget::GetFPos
| PpcImportDispatcherTarget::SetFPos
| PpcImportDispatcherTarget::PBSetFPos
| PpcImportDispatcherTarget::PBCreate(_)
| PpcImportDispatcherTarget::FSpCreate
| PpcImportDispatcherTarget::HCreate
| PpcImportDispatcherTarget::HRename
| PpcImportDispatcherTarget::Create
| PpcImportDispatcherTarget::FSpDelete
| PpcImportDispatcherTarget::DeleteByName(_)
| PpcImportDispatcherTarget::FSOpen
| PpcImportDispatcherTarget::FSpCreateResFile
| PpcImportDispatcherTarget::HCreateResFile
| PpcImportDispatcherTarget::FSpOpenResFile
| PpcImportDispatcherTarget::FSpOpenDF
| PpcImportDispatcherTarget::FSpOpenRF
| PpcImportDispatcherTarget::HOpen
| PpcImportDispatcherTarget::PBOpen
| PpcImportDispatcherTarget::PBHOpenDF
| PpcImportDispatcherTarget::CurResFile
| PpcImportDispatcherTarget::UseResFile
| PpcImportDispatcherTarget::OpenResFile
| PpcImportDispatcherTarget::HOpenResFile
| PpcImportDispatcherTarget::ResError
| PpcImportDispatcherTarget::GetVol
| PpcImportDispatcherTarget::GetWDInfo
| PpcImportDispatcherTarget::HGetVol
| PpcImportDispatcherTarget::HSetVol
| PpcImportDispatcherTarget::FlushVol
| PpcImportDispatcherTarget::PBFlushVol
| PpcImportDispatcherTarget::PBHGetVInfo
| PpcImportDispatcherTarget::GetVInfo
| PpcImportDispatcherTarget::PBDTGetPath
| PpcImportDispatcherTarget::PBDTGetCommentSync
| PpcImportDispatcherTarget::PBGetFInfo
| PpcImportDispatcherTarget::PBHGetFInfo
| PpcImportDispatcherTarget::PBSetFInfo
| PpcImportDispatcherTarget::PBHSetFInfo
| PpcImportDispatcherTarget::FSpGetFInfo
| PpcImportDispatcherTarget::GetFInfo
| PpcImportDispatcherTarget::HGetFInfo
| PpcImportDispatcherTarget::FSpSetFInfo
| PpcImportDispatcherTarget::HSetFInfo
| PpcImportDispatcherTarget::PBGetCatInfo
| PpcImportDispatcherTarget::PBSetCatInfo
| PpcImportDispatcherTarget::DirCreate
| PpcImportDispatcherTarget::FSpDirCreate
| PpcImportDispatcherTarget::FSMakeFSSpec
| PpcImportDispatcherTarget::PBGetFCBInfo
| PpcImportDispatcherTarget::FindFolder
| PpcImportDispatcherTarget::ResolveAliasFile
| PpcImportDispatcherTarget::ResolveAliasFileWithMountFlags
| PpcImportDispatcherTarget::GetIconRefFromFile
| PpcImportDispatcherTarget::GetIconRef
| PpcImportDispatcherTarget::PlotIconRef
| PpcImportDispatcherTarget::ReleaseIconRef
| PpcImportDispatcherTarget::ResolveAlias
| PpcImportDispatcherTarget::UpdateAlias
| PpcImportDispatcherTarget::NewAlias
| PpcImportDispatcherTarget::NewAliasMinimalFromFullPath
| PpcImportDispatcherTarget::FileCompatibility(_) => {
unreachable!("file imports return through dispatch_file_import")
}
PpcImportDispatcherTarget::SetResLoad
| PpcImportDispatcherTarget::LMGetResLoad
| PpcImportDispatcherTarget::LoadResource
| PpcImportDispatcherTarget::GetResource
| PpcImportDispatcherTarget::Get1Resource
| PpcImportDispatcherTarget::GetNamedResource
| PpcImportDispatcherTarget::Get1NamedResource
| PpcImportDispatcherTarget::GetIndResource
| PpcImportDispatcherTarget::Get1IndResource
| PpcImportDispatcherTarget::CountResources
| PpcImportDispatcherTarget::Count1Resources
| PpcImportDispatcherTarget::CountTypes
| PpcImportDispatcherTarget::Count1Types
| PpcImportDispatcherTarget::GetIndType
| PpcImportDispatcherTarget::Get1IndType
| PpcImportDispatcherTarget::UniqueID
| PpcImportDispatcherTarget::Unique1ID
| PpcImportDispatcherTarget::ReleaseResource
| PpcImportDispatcherTarget::DetachResource
| PpcImportDispatcherTarget::GetIndString
| PpcImportDispatcherTarget::GetString
| PpcImportDispatcherTarget::GetResAttrs
| PpcImportDispatcherTarget::SetResAttrs
| PpcImportDispatcherTarget::GetResInfo
| PpcImportDispatcherTarget::GetResourceSizeOnDisk
| PpcImportDispatcherTarget::SetResInfo
| PpcImportDispatcherTarget::HomeResFile
| PpcImportDispatcherTarget::UpdateResFile
| PpcImportDispatcherTarget::AddResource
| PpcImportDispatcherTarget::ChangedResource
| PpcImportDispatcherTarget::WriteResource
| PpcImportDispatcherTarget::RemoveResource
| PpcImportDispatcherTarget::ReadPartialResource
| PpcImportDispatcherTarget::CloseResFile
| PpcImportDispatcherTarget::GetPicture
| PpcImportDispatcherTarget::GetIconSuite
| PpcImportDispatcherTarget::GetIcon
| PpcImportDispatcherTarget::GetPattern
| PpcImportDispatcherTarget::GetIndPattern
| PpcImportDispatcherTarget::GetPixPat
| PpcImportDispatcherTarget::GetIntlResource => {
unreachable!("resource imports return through dispatch_resource_import")
}
PpcImportDispatcherTarget::InitGraf
| PpcImportDispatcherTarget::GetForeColor
| PpcImportDispatcherTarget::GetBackColor
| PpcImportDispatcherTarget::ForeColor
| PpcImportDispatcherTarget::BackColor
| PpcImportDispatcherTarget::RGBForeColor
| PpcImportDispatcherTarget::RGBBackColor
| PpcImportDispatcherTarget::OpColor
| PpcImportDispatcherTarget::HiliteColor
| PpcImportDispatcherTarget::PmForeColor
| PpcImportDispatcherTarget::PmBackColor
| PpcImportDispatcherTarget::Color2Index
| PpcImportDispatcherTarget::Index2Color
| PpcImportDispatcherTarget::RGB2HSL
| PpcImportDispatcherTarget::RGB2HSV
| PpcImportDispatcherTarget::HSV2RGB
| PpcImportDispatcherTarget::SetRect
| PpcImportDispatcherTarget::SectRect
| PpcImportDispatcherTarget::UnionRect
| PpcImportDispatcherTarget::EqualRect
| PpcImportDispatcherTarget::EmptyRect
| PpcImportDispatcherTarget::SetPt
| PpcImportDispatcherTarget::EqualPt
| PpcImportDispatcherTarget::AddPt
| PpcImportDispatcherTarget::SubPt
| PpcImportDispatcherTarget::LocalToGlobal
| PpcImportDispatcherTarget::GlobalToLocal
| PpcImportDispatcherTarget::PtInRect
| PpcImportDispatcherTarget::OffsetRect
| PpcImportDispatcherTarget::MapRect
| PpcImportDispatcherTarget::InsetRect => {
unreachable!("QuickDraw imports return through dispatch_quickdraw_import")
}
PpcImportDispatcherTarget::MathCeil
| PpcImportDispatcherTarget::MathSqrt
| PpcImportDispatcherTarget::MathExp
| PpcImportDispatcherTarget::MathSin
| PpcImportDispatcherTarget::MathCos
| PpcImportDispatcherTarget::MathAsin
| PpcImportDispatcherTarget::MathTan
| PpcImportDispatcherTarget::MathAtan
| PpcImportDispatcherTarget::MathAtan2
| PpcImportDispatcherTarget::MathPow
| PpcImportDispatcherTarget::MathFmod
| PpcImportDispatcherTarget::MathLog
| PpcImportDispatcherTarget::MathLog10
| PpcImportDispatcherTarget::MathDtox80
| PpcImportDispatcherTarget::X2Fix
| PpcImportDispatcherTarget::FixRatio
| PpcImportDispatcherTarget::FixMul
| PpcImportDispatcherTarget::FixDiv
| PpcImportDispatcherTarget::Long2Fix
| PpcImportDispatcherTarget::Fix2Long
| PpcImportDispatcherTarget::FixRound
| PpcImportDispatcherTarget::Fix2Frac
| PpcImportDispatcherTarget::Frac2Fix
| PpcImportDispatcherTarget::Frac2X
| PpcImportDispatcherTarget::X2Frac
| PpcImportDispatcherTarget::FracSin
| PpcImportDispatcherTarget::FracCos
| PpcImportDispatcherTarget::FracSqrt
| PpcImportDispatcherTarget::FracMul
| PpcImportDispatcherTarget::FracDiv
| PpcImportDispatcherTarget::FixATan2
| PpcImportDispatcherTarget::WideAdd
| PpcImportDispatcherTarget::WideSubtract
| PpcImportDispatcherTarget::WideNegate
| PpcImportDispatcherTarget::WideShift
| PpcImportDispatcherTarget::WideBitShift
| PpcImportDispatcherTarget::WideMultiply
| PpcImportDispatcherTarget::WideDivide
| PpcImportDispatcherTarget::WideWideDivide
| PpcImportDispatcherTarget::WideCompare
| PpcImportDispatcherTarget::WideSquareRoot => {
unreachable!("math imports return through dispatch_math_import")
}
PpcImportDispatcherTarget::MoveTo
| PpcImportDispatcherTarget::Move
| PpcImportDispatcherTarget::LineTo
| PpcImportDispatcherTarget::Line => {
unreachable!("QuickDraw imports return through dispatch_quickdraw_import")
}
PpcImportDispatcherTarget::DrawChar
| PpcImportDispatcherTarget::DrawText
| PpcImportDispatcherTarget::DrawString
| PpcImportDispatcherTarget::TextFont
| PpcImportDispatcherTarget::TextFace
| PpcImportDispatcherTarget::TextMode
| PpcImportDispatcherTarget::TextSize => {
unreachable!("font and text imports return through dispatch_font_import")
}
PpcImportDispatcherTarget::PaintRect
| PpcImportDispatcherTarget::EraseRect
| PpcImportDispatcherTarget::InvertRect
| PpcImportDispatcherTarget::FrameRect
| PpcImportDispatcherTarget::FillRect
| PpcImportDispatcherTarget::FillCRect => {
unreachable!("QuickDraw imports return through dispatch_quickdraw_import")
}
PpcImportDispatcherTarget::FrameOval
| PpcImportDispatcherTarget::PaintOval
| PpcImportDispatcherTarget::EraseOval
| PpcImportDispatcherTarget::PaintArc => {
unreachable!("QuickDraw imports return through dispatch_quickdraw_import")
}
PpcImportDispatcherTarget::FrameRgn
| PpcImportDispatcherTarget::PaintRgn
| PpcImportDispatcherTarget::FillRgn
| PpcImportDispatcherTarget::InvertRgn => {
unreachable!("QuickDraw imports return through dispatch_quickdraw_import")
}
PpcImportDispatcherTarget::FrameRoundRect | PpcImportDispatcherTarget::PaintRoundRect => {
unreachable!("QuickDraw imports return through dispatch_quickdraw_import")
}
PpcImportDispatcherTarget::InvalRect
| PpcImportDispatcherTarget::ValidRect
| PpcImportDispatcherTarget::BeginUpdate
| PpcImportDispatcherTarget::EndUpdate => {
unreachable!("window imports return through dispatch_window_import")
}
PpcImportDispatcherTarget::ClipRect
| PpcImportDispatcherTarget::GetClip
| PpcImportDispatcherTarget::SetClip
| PpcImportDispatcherTarget::BitMapToRegion
| PpcImportDispatcherTarget::NewRgn
| PpcImportDispatcherTarget::DisposeRgn
| PpcImportDispatcherTarget::CopyRgn
| PpcImportDispatcherTarget::OpenRgn
| PpcImportDispatcherTarget::CloseRgn
| PpcImportDispatcherTarget::SectRgn
| PpcImportDispatcherTarget::UnionRgn
| PpcImportDispatcherTarget::DiffRgn
| PpcImportDispatcherTarget::XorRgn
| PpcImportDispatcherTarget::SetEmptyRgn
| PpcImportDispatcherTarget::SetRectRgn
| PpcImportDispatcherTarget::RectRgn
| PpcImportDispatcherTarget::OffsetRgn
| PpcImportDispatcherTarget::EmptyRgn
| PpcImportDispatcherTarget::PtInRgn
| PpcImportDispatcherTarget::RectInRgn => {
unreachable!("Region Manager imports return through dispatch_region_import")
}
PpcImportDispatcherTarget::GetPen
| PpcImportDispatcherTarget::HidePen
| PpcImportDispatcherTarget::ShowPen
| PpcImportDispatcherTarget::PenSize
| PpcImportDispatcherTarget::PenMode
| PpcImportDispatcherTarget::PenNormal
| PpcImportDispatcherTarget::PenPixPat
| PpcImportDispatcherTarget::GetPenState
| PpcImportDispatcherTarget::SetPenState => {
unreachable!("QuickDraw imports return through dispatch_quickdraw_import")
}
PpcImportDispatcherTarget::CopyBits => {
unreachable!("bit-transfer imports return through dispatch_bit_transfer_import")
}
PpcImportDispatcherTarget::OpenPoly
| PpcImportDispatcherTarget::ClosePoly
| PpcImportDispatcherTarget::KillPoly
| PpcImportDispatcherTarget::FramePoly
| PpcImportDispatcherTarget::PaintPoly
| PpcImportDispatcherTarget::FillPoly => {
unreachable!("Polygon Manager imports return through dispatch_polygon_import")
}
PpcImportDispatcherTarget::NewCWindow
| PpcImportDispatcherTarget::GetNewCWindow
| PpcImportDispatcherTarget::GetWRefCon
| PpcImportDispatcherTarget::SetWRefCon
| PpcImportDispatcherTarget::SizeWindow
| PpcImportDispatcherTarget::MoveWindow => {
unreachable!("window imports return through dispatch_window_import")
}
PpcImportDispatcherTarget::ShowWindow
| PpcImportDispatcherTarget::HideWindow
| PpcImportDispatcherTarget::ShowHide
| PpcImportDispatcherTarget::CloseWindow => {
unreachable!("window imports return through dispatch_window_import")
}
PpcImportDispatcherTarget::CloseDialog | PpcImportDispatcherTarget::DisposeDialog => {
unreachable!("dialog imports return through dispatch_dialog_import")
}
PpcImportDispatcherTarget::FrontWindow
| PpcImportDispatcherTarget::SetWinColor
| PpcImportDispatcherTarget::PaintOne
| PpcImportDispatcherTarget::PaintBehind
| PpcImportDispatcherTarget::CalcVisBehind => {
unreachable!("window imports return through dispatch_window_import")
}
PpcImportDispatcherTarget::SelectWindow => {
unreachable!("window imports return through dispatch_window_import")
}
PpcImportDispatcherTarget::ActivatePalette
| PpcImportDispatcherTarget::NSetPalette
| PpcImportDispatcherTarget::GetPalette => {
unreachable!("palette imports return through dispatch_palette_import")
}
PpcImportDispatcherTarget::GetPort
| PpcImportDispatcherTarget::SetPort
| PpcImportDispatcherTarget::GetWindowPort
| PpcImportDispatcherTarget::SetPortWindowPort
| PpcImportDispatcherTarget::NewGWorld
| PpcImportDispatcherTarget::UpdateGWorld
| PpcImportDispatcherTarget::DisposeGWorld
| PpcImportDispatcherTarget::QDError
| PpcImportDispatcherTarget::GetGWorld
| PpcImportDispatcherTarget::SetGWorld
| PpcImportDispatcherTarget::GetGWorldDevice
| PpcImportDispatcherTarget::GetGWorldPixMap
| PpcImportDispatcherTarget::OpenPort
| PpcImportDispatcherTarget::OpenCPort
| PpcImportDispatcherTarget::CloseCPort
| PpcImportDispatcherTarget::SetPortBits { .. }
| PpcImportDispatcherTarget::GetPixBaseAddr
| PpcImportDispatcherTarget::GetPixRowBytes
| PpcImportDispatcherTarget::LockPixels
| PpcImportDispatcherTarget::UnlockPixels
| PpcImportDispatcherTarget::GetPixelsState
| PpcImportDispatcherTarget::SetPixelsState
| PpcImportDispatcherTarget::AllowPurgePixels
| PpcImportDispatcherTarget::NoPurgePixels
| PpcImportDispatcherTarget::SetOrigin => {
unreachable!("GWorld imports return through dispatch_gworld_import")
}
PpcImportDispatcherTarget::GetWMgrPort => {
unreachable!("window imports return through dispatch_window_import")
}
PpcImportDispatcherTarget::GetGDevice
| PpcImportDispatcherTarget::SetGDevice
| PpcImportDispatcherTarget::GetDeviceList
| PpcImportDispatcherTarget::GetMainDevice
| PpcImportDispatcherTarget::GetMaxDevice
| PpcImportDispatcherTarget::GetNextDevice
| PpcImportDispatcherTarget::TestDeviceAttribute
| PpcImportDispatcherTarget::SetDeviceAttribute
| PpcImportDispatcherTarget::HasDepth
| PpcImportDispatcherTarget::SetDepth => {
unreachable!("graphics-device imports return through dispatch_graphics_device_import")
}
PpcImportDispatcherTarget::GetSysFont
| PpcImportDispatcherTarget::GetAppFont
| PpcImportDispatcherTarget::GetDefFontSize
| PpcImportDispatcherTarget::GetFontName => {
unreachable!("Font Manager imports return through dispatch_font_import")
}
PpcImportDispatcherTarget::DMGetDisplayIDByGDevice
| PpcImportDispatcherTarget::DMGetNameByAVID
| PpcImportDispatcherTarget::DMGetGDeviceByDisplayID => {
unreachable!("display manager imports return through dispatch_display_import")
}
PpcImportDispatcherTarget::GetCTable
| PpcImportDispatcherTarget::GetCTSeed
| PpcImportDispatcherTarget::MakeITable
| PpcImportDispatcherTarget::CTabChanged
| PpcImportDispatcherTarget::ProtectEntry
| PpcImportDispatcherTarget::ReserveEntry
| PpcImportDispatcherTarget::RestoreEntries
| PpcImportDispatcherTarget::SetEntries
| PpcImportDispatcherTarget::RestoreDeviceClut
| PpcImportDispatcherTarget::DisposeCTable
| PpcImportDispatcherTarget::NewPixMap
| PpcImportDispatcherTarget::DisposePixMap => {
unreachable!("color-table imports return through dispatch_color_table_import")
}
PpcImportDispatcherTarget::FindWindow => {
unreachable!("window imports return through dispatch_window_import")
}
PpcImportDispatcherTarget::GetDCtlEntry
| PpcImportDispatcherTarget::GetADBInfo
| PpcImportDispatcherTarget::OpenDriver
| PpcImportDispatcherTarget::Control
| PpcImportDispatcherTarget::PBControl
| PpcImportDispatcherTarget::PBStatus => {
unreachable!("Device Manager imports return through dispatch_device_import")
}
PpcImportDispatcherTarget::Gestalt | PpcImportDispatcherTarget::NewGestaltValue => {
unreachable!("Gestalt imports return through dispatch_gestalt_import")
}
PpcImportDispatcherTarget::GetSharedLibrary
| PpcImportDispatcherTarget::FindSymbol
| PpcImportDispatcherTarget::CountSymbols
| PpcImportDispatcherTarget::GetIndSymbol
| PpcImportDispatcherTarget::CloseConnection
| PpcImportDispatcherTarget::GetMemFragment
| PpcImportDispatcherTarget::GetDiskFragment => {
unreachable!("cfm imports return through dispatch_cfm_import")
}
PpcImportDispatcherTarget::StandardGetFile => {
unreachable!("standard file imports return through dispatch_standard_file_import")
}
PpcImportDispatcherTarget::GetScrap
| PpcImportDispatcherTarget::PutScrap
| PpcImportDispatcherTarget::ZeroScrap
| PpcImportDispatcherTarget::LoadScrap
| PpcImportDispatcherTarget::UnloadScrap => {
unreachable!("Scrap Manager imports return through dispatch_scrap_import")
}
PpcImportDispatcherTarget::DMGetFirstScreenDevice
| PpcImportDispatcherTarget::DMGetNextScreenDevice
| PpcImportDispatcherTarget::DMGetDisplayMode
| PpcImportDispatcherTarget::DMCheckDisplayMode
| PpcImportDispatcherTarget::DMSetDisplayMode
| PpcImportDispatcherTarget::DMNewDisplayModeList
| PpcImportDispatcherTarget::DMGetIndexedDisplayModeFromList
| PpcImportDispatcherTarget::DMDisposeList
| PpcImportDispatcherTarget::DMBeginConfigureDisplays
| PpcImportDispatcherTarget::DMEndConfigureDisplays => {
unreachable!("display manager imports return through dispatch_display_import")
}
PpcImportDispatcherTarget::GetNewDialog
| PpcImportDispatcherTarget::NewDialog
| PpcImportDispatcherTarget::NewFeaturesDialog
| PpcImportDispatcherTarget::GetDialogItem
| PpcImportDispatcherTarget::GetDialogItemAsControl
| PpcImportDispatcherTarget::SetDialogItem
| PpcImportDispatcherTarget::GetDialogItemText
| PpcImportDispatcherTarget::SetDialogItemText
| PpcImportDispatcherTarget::SetDialogDefaultItem
| PpcImportDispatcherTarget::SetDialogCancelItem
| PpcImportDispatcherTarget::SetDialogTracksCursor
| PpcImportDispatcherTarget::StdFilterProc
| PpcImportDispatcherTarget::DrawDialog
| PpcImportDispatcherTarget::ModalDialog => {
unreachable!("dialog imports return through dispatch_dialog_import")
}
PpcImportDispatcherTarget::DrawControls => {
unreachable!("control imports return through dispatch_control_import")
}
PpcImportDispatcherTarget::SetControlTitle
| PpcImportDispatcherTarget::SetControlValue
| PpcImportDispatcherTarget::HiliteControl => {
unreachable!("control imports return through dispatch_control_import")
}
PpcImportDispatcherTarget::InitFonts => {
unreachable!("Font Manager imports return through dispatch_font_import")
}
PpcImportDispatcherTarget::InitWindows => {
unreachable!("window imports return through dispatch_window_import")
}
PpcImportDispatcherTarget::MeasureText | PpcImportDispatcherTarget::RealFont => {
unreachable!("Font Manager imports return through dispatch_font_import")
}
PpcImportDispatcherTarget::SelectDialogItemText
| PpcImportDispatcherTarget::InitDialogs => {
unreachable!("dialog imports return through dispatch_dialog_import")
}
PpcImportDispatcherTarget::SystemTask
| PpcImportDispatcherTarget::SystemClick
| PpcImportDispatcherTarget::OpenDeskAcc => {
unreachable!("Desk Manager imports return through dispatch_desk_import")
}
PpcImportDispatcherTarget::AEInstallEventHandler
| PpcImportDispatcherTarget::AEProcessAppleEvent => {
unreachable!("Apple Event imports return through dispatch_apple_event_import")
}
PpcImportDispatcherTarget::LNew
| PpcImportDispatcherTarget::LDispose
| PpcImportDispatcherTarget::LAddRow
| PpcImportDispatcherTarget::LDelRow
| PpcImportDispatcherTarget::LGetSelect
| PpcImportDispatcherTarget::LSetSelect
| PpcImportDispatcherTarget::LSetCell
| PpcImportDispatcherTarget::LGetCell
| PpcImportDispatcherTarget::LClick
| PpcImportDispatcherTarget::LActivate
| PpcImportDispatcherTarget::LSetDrawingMode
| PpcImportDispatcherTarget::LScroll
| PpcImportDispatcherTarget::LSize
| PpcImportDispatcherTarget::LUpdate
| PpcImportDispatcherTarget::LAutoScroll
| PpcImportDispatcherTarget::LSearch => {
unreachable!("list imports return through dispatch_list_import")
}
PpcImportDispatcherTarget::SysEnvirons
| PpcImportDispatcherTarget::SVersion
| PpcImportDispatcherTarget::EqualString
| PpcImportDispatcherTarget::NumToString
| PpcImportDispatcherTarget::StringToNum
| PpcImportDispatcherTarget::Random
| PpcImportDispatcherTarget::BitAnd
| PpcImportDispatcherTarget::BitOr
| PpcImportDispatcherTarget::BitTst => {
unreachable!("Toolbox Utilities imports return through dispatch_toolbox_import")
}
PpcImportDispatcherTarget::IUEqualPString => None,
PpcImportDispatcherTarget::TextWidth
| PpcImportDispatcherTarget::TruncString
| PpcImportDispatcherTarget::StringWidth
| PpcImportDispatcherTarget::CharWidth
| PpcImportDispatcherTarget::GetFontInfo
| PpcImportDispatcherTarget::FontMetrics
| PpcImportDispatcherTarget::GetFNum => {
unreachable!("Font Manager imports return through dispatch_font_import")
}
PpcImportDispatcherTarget::AESetInteractionAllowed
| PpcImportDispatcherTarget::AEGetInteractionAllowed => {
unreachable!("Apple Event imports return through dispatch_apple_event_import")
}
PpcImportDispatcherTarget::StdMemset
| PpcImportDispatcherTarget::StdMemcmp
| PpcImportDispatcherTarget::StdMemcpy
| PpcImportDispatcherTarget::StdMemmove => {
unreachable!("stdc imports return through dispatch_stdc_import")
}
PpcImportDispatcherTarget::StdMalloc
| PpcImportDispatcherTarget::StdFree
| PpcImportDispatcherTarget::StdCalloc
| PpcImportDispatcherTarget::StdRealloc
| PpcImportDispatcherTarget::StdStrcpy
| PpcImportDispatcherTarget::StdStrncpy
| PpcImportDispatcherTarget::StdStrcat
| PpcImportDispatcherTarget::StdStrncat
| PpcImportDispatcherTarget::StdStrcmp
| PpcImportDispatcherTarget::StdStrncmp
| PpcImportDispatcherTarget::StdStrlen
| PpcImportDispatcherTarget::StdMemchr
| PpcImportDispatcherTarget::StdStrchr
| PpcImportDispatcherTarget::StdStrrchr
| PpcImportDispatcherTarget::StdStrspn
| PpcImportDispatcherTarget::StdStrcspn
| PpcImportDispatcherTarget::StdStrpbrk
| PpcImportDispatcherTarget::StdStrstr
| PpcImportDispatcherTarget::StdAtoi
| PpcImportDispatcherTarget::StdGetenv
| PpcImportDispatcherTarget::StdSprintf => {
unreachable!("stdc imports return through dispatch_stdc_import")
}
PpcImportDispatcherTarget::StdIoCompatibility(operation) => {
Some(ppc_dispatch_process_stdio_compatibility(
operation,
cpu,
process_memory_manager,
memory,
heap_cursor,
heap_limit,
files,
writable_refnums,
vfs_files,
next_file_ref_num,
stdio_streams,
))
}
PpcImportDispatcherTarget::StdAbs
| PpcImportDispatcherTarget::StdToupper
| PpcImportDispatcherTarget::StdTolower
| PpcImportDispatcherTarget::StdIsalnum
| PpcImportDispatcherTarget::StdIsalpha
| PpcImportDispatcherTarget::StdIsascii
| PpcImportDispatcherTarget::StdIscntrl
| PpcImportDispatcherTarget::StdIsdigit
| PpcImportDispatcherTarget::StdIsgraph
| PpcImportDispatcherTarget::StdIslower
| PpcImportDispatcherTarget::StdIsprint
| PpcImportDispatcherTarget::StdIspunct
| PpcImportDispatcherTarget::StdIsspace
| PpcImportDispatcherTarget::StdIsupper
| PpcImportDispatcherTarget::StdIsxdigit
| PpcImportDispatcherTarget::StdToascii
| PpcImportDispatcherTarget::StdSrand
| PpcImportDispatcherTarget::StdRand
| PpcImportDispatcherTarget::StdTime
| PpcImportDispatcherTarget::P2CStr
| PpcImportDispatcherTarget::C2PStr
| PpcImportDispatcherTarget::CopyCStringToPascal
| PpcImportDispatcherTarget::CopyPascalStringToC
| PpcImportDispatcherTarget::UpperText => {
unreachable!("stdc imports return through dispatch_stdc_import")
}
PpcImportDispatcherTarget::CfStringMakeConstantString
| PpcImportDispatcherTarget::CfStringCreateWithCString
| PpcImportDispatcherTarget::CfStringCreateWithPascalString
| PpcImportDispatcherTarget::CfStringCreateWithBytes
| PpcImportDispatcherTarget::CfStringGetCString
| PpcImportDispatcherTarget::CfStringGetBytes
| PpcImportDispatcherTarget::CfStringGetLength
| PpcImportDispatcherTarget::CfStringGetSystemEncoding
| PpcImportDispatcherTarget::CfRetain
| PpcImportDispatcherTarget::CfRelease
| PpcImportDispatcherTarget::CfGetRetainCount
| PpcImportDispatcherTarget::CfBundleGetBundleWithIdentifier => {
unreachable!("Core Foundation imports return through typed dispatch")
}
PpcImportDispatcherTarget::GetCurrentProcess
| PpcImportDispatcherTarget::WakeUpProcess
| PpcImportDispatcherTarget::SameProcess
| PpcImportDispatcherTarget::GetProcessInformation => {
unreachable!("Process Manager imports return through dispatch_process_import")
}
PpcImportDispatcherTarget::ParamText
| PpcImportDispatcherTarget::AlertReturnDefault
| PpcImportDispatcherTarget::StandardAlert => {
unreachable!("dialog imports return through dispatch_dialog_import")
}
PpcImportDispatcherTarget::Q3Initialize
| PpcImportDispatcherTarget::Q3Exit
| PpcImportDispatcherTarget::Q3GetVersion => {
unreachable!("QuickDraw 3D core imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3MemoryStorageNew
| PpcImportDispatcherTarget::Q3MemoryStorageNewBuffer
| PpcImportDispatcherTarget::Q3FSSpecStorageNew => {
unreachable!("QuickDraw 3D storage imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3NewObject => {
unreachable!("QuickDraw 3D core imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3FileNew => {
unreachable!("QuickDraw 3D file imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3ViewNew
| PpcImportDispatcherTarget::Q3DisplayGroupNew
| PpcImportDispatcherTarget::Q3OrderedDisplayGroupNew => {
unreachable!("QuickDraw 3D group/view imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3ErrorGet => {
unreachable!("QuickDraw 3D core imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3ObjectDispose
| PpcImportDispatcherTarget::Q3ObjectDuplicate
| PpcImportDispatcherTarget::Q3SharedGetReference
| PpcImportDispatcherTarget::Q3SharedIsReferenced
| PpcImportDispatcherTarget::Q3SharedGetType
| PpcImportDispatcherTarget::Q3ShapeGetType
| PpcImportDispatcherTarget::Q3ShapeGetLeafType
| PpcImportDispatcherTarget::Q3ObjectIsDrawable
| PpcImportDispatcherTarget::Q3ObjectIsType
| PpcImportDispatcherTarget::Q3ObjectGetType
| PpcImportDispatcherTarget::Q3ObjectGetLeafType
| PpcImportDispatcherTarget::Q3GeometryGetType => {
unreachable!("QuickDraw 3D object imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3ShaderGetType => {
unreachable!("QuickDraw 3D shader imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3GroupGetType
| PpcImportDispatcherTarget::Q3RendererNewFromType
| PpcImportDispatcherTarget::Q3RendererGetType
| PpcImportDispatcherTarget::Q3RendererSync
| PpcImportDispatcherTarget::Q3RendererFlush => {
unreachable!("QuickDraw 3D object/renderer imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3InteractiveRendererSetDoubleBufferBypass
| PpcImportDispatcherTarget::Q3InteractiveRendererSetPreferences
| PpcImportDispatcherTarget::Q3InteractiveRendererSetRaveContextHints
| PpcImportDispatcherTarget::Q3InteractiveRendererGetRaveContextHints
| PpcImportDispatcherTarget::Q3InteractiveRendererGetRaveDrawContexts
| PpcImportDispatcherTarget::Q3InteractiveRendererSetRaveTextureFilter => {
unreachable!("QuickDraw 3D object/renderer imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3TextureShaderNew
| PpcImportDispatcherTarget::Q3LambertIlluminationNew
| PpcImportDispatcherTarget::Q3NullIlluminationNew
| PpcImportDispatcherTarget::Q3PhongIlluminationNew
| PpcImportDispatcherTarget::Q3TextureShaderGetTexture
| PpcImportDispatcherTarget::Q3MipmapTextureNew
| PpcImportDispatcherTarget::Q3MipmapTextureGetMipmap => {
unreachable!(
"QuickDraw 3D shader imports return through dispatch_q3_shader_style_import_fast"
)
}
PpcImportDispatcherTarget::Q3StorageGetType
| PpcImportDispatcherTarget::Q3MemoryStorageSet
| PpcImportDispatcherTarget::Q3MemoryStorageGetBuffer
| PpcImportDispatcherTarget::Q3MemoryStorageSetBuffer
| PpcImportDispatcherTarget::Q3MemoryStorageGetType => {
unreachable!("QuickDraw 3D storage imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3ViewAngleAspectCameraNew
| PpcImportDispatcherTarget::Q3OrthographicCameraNew
| PpcImportDispatcherTarget::Q3ViewPlaneCameraNew
| PpcImportDispatcherTarget::Q3CameraGetPlacement
| PpcImportDispatcherTarget::Q3CameraSetPlacement
| PpcImportDispatcherTarget::Q3CameraGetRange
| PpcImportDispatcherTarget::Q3CameraSetRange
| PpcImportDispatcherTarget::Q3CameraGetViewPort
| PpcImportDispatcherTarget::Q3CameraSetViewPort
| PpcImportDispatcherTarget::Q3CameraGetWorldToView
| PpcImportDispatcherTarget::Q3CameraGetViewToFrustum => {
unreachable!("QuickDraw 3D scene imports return through dispatch_q3_scene_import_fast")
}
PpcImportDispatcherTarget::Q3LightGetType
| PpcImportDispatcherTarget::Q3LightGetState
| PpcImportDispatcherTarget::Q3LightSetState
| PpcImportDispatcherTarget::Q3LightGetBrightness
| PpcImportDispatcherTarget::Q3LightSetBrightness
| PpcImportDispatcherTarget::Q3LightGetColor
| PpcImportDispatcherTarget::Q3LightSetColor
| PpcImportDispatcherTarget::Q3LightGetData
| PpcImportDispatcherTarget::Q3LightSetData
| PpcImportDispatcherTarget::Q3AmbientLightNew
| PpcImportDispatcherTarget::Q3AmbientLightGetData
| PpcImportDispatcherTarget::Q3AmbientLightSetData
| PpcImportDispatcherTarget::Q3DirectionalLightNew
| PpcImportDispatcherTarget::Q3DirectionalLightGetCastShadowsState
| PpcImportDispatcherTarget::Q3DirectionalLightSetCastShadowsState
| PpcImportDispatcherTarget::Q3DirectionalLightGetDirection
| PpcImportDispatcherTarget::Q3DirectionalLightSetDirection
| PpcImportDispatcherTarget::Q3DirectionalLightGetData
| PpcImportDispatcherTarget::Q3DirectionalLightSetData => {
unreachable!("QuickDraw 3D scene imports return through dispatch_q3_scene_import_fast")
}
PpcImportDispatcherTarget::Q3PointLightNew
| PpcImportDispatcherTarget::Q3PointLightGetCastShadowsState
| PpcImportDispatcherTarget::Q3PointLightSetCastShadowsState
| PpcImportDispatcherTarget::Q3PointLightGetAttenuation
| PpcImportDispatcherTarget::Q3PointLightSetAttenuation
| PpcImportDispatcherTarget::Q3PointLightGetLocation
| PpcImportDispatcherTarget::Q3PointLightSetLocation
| PpcImportDispatcherTarget::Q3PointLightGetData
| PpcImportDispatcherTarget::Q3PointLightSetData
| PpcImportDispatcherTarget::Q3SpotLightNew
| PpcImportDispatcherTarget::Q3SpotLightGetCastShadowsState
| PpcImportDispatcherTarget::Q3SpotLightSetCastShadowsState
| PpcImportDispatcherTarget::Q3SpotLightGetAttenuation
| PpcImportDispatcherTarget::Q3SpotLightSetAttenuation
| PpcImportDispatcherTarget::Q3SpotLightGetLocation
| PpcImportDispatcherTarget::Q3SpotLightSetLocation
| PpcImportDispatcherTarget::Q3SpotLightGetDirection
| PpcImportDispatcherTarget::Q3SpotLightSetDirection
| PpcImportDispatcherTarget::Q3SpotLightGetHotAngle
| PpcImportDispatcherTarget::Q3SpotLightSetHotAngle
| PpcImportDispatcherTarget::Q3SpotLightGetOuterAngle
| PpcImportDispatcherTarget::Q3SpotLightSetOuterAngle
| PpcImportDispatcherTarget::Q3SpotLightGetFallOff
| PpcImportDispatcherTarget::Q3SpotLightSetFallOff
| PpcImportDispatcherTarget::Q3SpotLightGetData
| PpcImportDispatcherTarget::Q3SpotLightSetData => {
unreachable!("QuickDraw 3D scene imports return through dispatch_q3_scene_import_fast")
}
PpcImportDispatcherTarget::Q3ShaderGetUVTransform
| PpcImportDispatcherTarget::Q3ShaderSetUVTransform
| PpcImportDispatcherTarget::Q3ShaderGetUBoundary
| PpcImportDispatcherTarget::Q3ShaderSetUBoundary
| PpcImportDispatcherTarget::Q3ShaderGetVBoundary
| PpcImportDispatcherTarget::Q3ShaderSetVBoundary => {
unreachable!(
"QuickDraw 3D shader imports return through dispatch_q3_shader_style_import_fast"
)
}
PpcImportDispatcherTarget::Q3BackfacingStyleNew
| PpcImportDispatcherTarget::Q3BackfacingStyleGet
| PpcImportDispatcherTarget::Q3BackfacingStyleSet
| PpcImportDispatcherTarget::Q3InterpolationStyleNew
| PpcImportDispatcherTarget::Q3InterpolationStyleGet
| PpcImportDispatcherTarget::Q3InterpolationStyleSet
| PpcImportDispatcherTarget::Q3FillStyleNew
| PpcImportDispatcherTarget::Q3FillStyleGet
| PpcImportDispatcherTarget::Q3FillStyleSet
| PpcImportDispatcherTarget::Q3OrientationStyleNew
| PpcImportDispatcherTarget::Q3OrientationStyleGet
| PpcImportDispatcherTarget::Q3OrientationStyleSet => {
unreachable!(
"QuickDraw 3D style imports return through dispatch_q3_shader_style_import_fast"
)
}
PpcImportDispatcherTarget::Q3TriMeshNew
| PpcImportDispatcherTarget::Q3TriMeshGetData
| PpcImportDispatcherTarget::Q3TriMeshSetData
| PpcImportDispatcherTarget::Q3TriMeshEmptyData
| PpcImportDispatcherTarget::Q3AttributeSetNew
| PpcImportDispatcherTarget::Q3AttributeSetAdd
| PpcImportDispatcherTarget::Q3AttributeSetGet
| PpcImportDispatcherTarget::Q3AttributeSetClear
| PpcImportDispatcherTarget::Q3AttributeSetContains
| PpcImportDispatcherTarget::Q3AttributeSetGetNextAttributeType => {
unreachable!("QuickDraw 3D geometry imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3StorageGetSize
| PpcImportDispatcherTarget::Q3StorageGetData
| PpcImportDispatcherTarget::Q3StorageSetData => {
unreachable!("QuickDraw 3D storage imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3PixmapDrawContextNew
| PpcImportDispatcherTarget::Q3MacDrawContextNew
| PpcImportDispatcherTarget::Q3DrawContextGetPane => {
unreachable!("QuickDraw 3D geometry imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3Vector3DNormalize
| PpcImportDispatcherTarget::Q3Vector3DLength
| PpcImportDispatcherTarget::Q3Vector2DNormalize
| PpcImportDispatcherTarget::Q3Vector3DCross
| PpcImportDispatcherTarget::Q3Point2DDistance
| PpcImportDispatcherTarget::Q3Point3DDistance
| PpcImportDispatcherTarget::Q3Point3DCrossProductTri
| PpcImportDispatcherTarget::Q3BoundingBoxSetFromPoints3D
| PpcImportDispatcherTarget::Q3Matrix3x3SetTranslate
| PpcImportDispatcherTarget::Q3Matrix4x4SetIdentity
| PpcImportDispatcherTarget::Q3Matrix4x4SetTranslate
| PpcImportDispatcherTarget::Q3Matrix4x4SetScale
| PpcImportDispatcherTarget::Q3Matrix4x4SetRotateX
| PpcImportDispatcherTarget::Q3Matrix4x4SetRotateY
| PpcImportDispatcherTarget::Q3Matrix4x4SetRotateZ
| PpcImportDispatcherTarget::Q3Matrix4x4SetRotateXyz
| PpcImportDispatcherTarget::Q3Matrix4x4Multiply
| PpcImportDispatcherTarget::Q3Matrix4x4Transpose
| PpcImportDispatcherTarget::Q3Matrix4x4Invert
| PpcImportDispatcherTarget::Q3Point3DTransform
| PpcImportDispatcherTarget::Q3Point3DTo3DTransformArray
| PpcImportDispatcherTarget::Q3Point3DTo4DTransformArray
| PpcImportDispatcherTarget::Q3Vector3DTransform
| PpcImportDispatcherTarget::Q3MatrixTransformNew
| PpcImportDispatcherTarget::Q3MatrixTransformSet
| PpcImportDispatcherTarget::Q3TransformGetMatrix => {
unreachable!("QuickDraw 3D math imports return through dispatch_q3_math_import_fast")
}
PpcImportDispatcherTarget::Q3FileSetStorage
| PpcImportDispatcherTarget::Q3FileOpenRead
| PpcImportDispatcherTarget::Q3FileReadObject
| PpcImportDispatcherTarget::Q3FileIsEndOfFile
| PpcImportDispatcherTarget::Q3FileClose => {
unreachable!("QuickDraw 3D file imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3GroupAddObject
| PpcImportDispatcherTarget::Q3GroupAddObjectBefore
| PpcImportDispatcherTarget::Q3GroupCountObjects
| PpcImportDispatcherTarget::Q3GroupGetFirstPosition
| PpcImportDispatcherTarget::Q3GroupGetNextPosition
| PpcImportDispatcherTarget::Q3GroupGetFirstPositionOfType
| PpcImportDispatcherTarget::Q3GroupGetPositionObject
| PpcImportDispatcherTarget::Q3GroupRemovePosition
| PpcImportDispatcherTarget::Q3LightGroupNew => {
unreachable!("QuickDraw 3D group imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3ViewSetRenderer
| PpcImportDispatcherTarget::Q3ViewGetRenderer
| PpcImportDispatcherTarget::Q3ViewSetLightGroup
| PpcImportDispatcherTarget::Q3ViewGetLightGroup
| PpcImportDispatcherTarget::Q3ViewSetDrawContext
| PpcImportDispatcherTarget::Q3ViewGetDrawContext
| PpcImportDispatcherTarget::Q3ViewSetCamera
| PpcImportDispatcherTarget::Q3ViewGetCamera
| PpcImportDispatcherTarget::Q3ViewGetWorldToFrustumMatrixState
| PpcImportDispatcherTarget::Q3ViewGetFrustumToWindowMatrixState
| PpcImportDispatcherTarget::Q3ViewStartRendering
| PpcImportDispatcherTarget::Q3ViewEndRendering
| PpcImportDispatcherTarget::Q3ViewStartBoundingBox
| PpcImportDispatcherTarget::Q3ViewEndBoundingBox
| PpcImportDispatcherTarget::Q3ViewStartBoundingSphere
| PpcImportDispatcherTarget::Q3ViewEndBoundingSphere
| PpcImportDispatcherTarget::Q3ViewCancel => {
unreachable!("QuickDraw 3D view imports return through typed dispatch")
}
PpcImportDispatcherTarget::Q3ShaderSubmit
| PpcImportDispatcherTarget::Q3StyleSubmit => {
unreachable!("QuickDraw 3D submissions return through typed dispatch")
}
PpcImportDispatcherTarget::Q3BackfacingStyleSubmit
| PpcImportDispatcherTarget::Q3InterpolationStyleSubmit
| PpcImportDispatcherTarget::Q3FillStyleSubmit
| PpcImportDispatcherTarget::Q3OrientationStyleSubmit => {
unreachable!("QuickDraw 3D submissions return through typed dispatch")
}
PpcImportDispatcherTarget::Q3FogStyleSubmit
| PpcImportDispatcherTarget::Q3TriMeshSubmit => {
unreachable!("QuickDraw 3D submissions return through typed dispatch")
}
PpcImportDispatcherTarget::Q3MatrixTransformSubmit
| PpcImportDispatcherTarget::Q3ResetTransformSubmit => {
unreachable!("QuickDraw 3D submissions return through typed dispatch")
}
PpcImportDispatcherTarget::Q3PushSubmit
| PpcImportDispatcherTarget::Q3PopSubmit
| PpcImportDispatcherTarget::Q3ObjectSubmit => {
unreachable!("QuickDraw 3D submissions return through typed dispatch")
}
PpcImportDispatcherTarget::QADeviceGetFirstEngine => {
Some(PpcImportAction::Return(PPC_QA_ENGINE))
}
PpcImportDispatcherTarget::QADeviceGetNextEngine => Some(PpcImportAction::Return(0)),
PpcImportDispatcherTarget::QAEngineGestalt => {
Some(PpcImportAction::Return(qd3d::ppc_qa_engine_gestalt(cpu, memory)))
}
PpcImportDispatcherTarget::CloseComponent => Some(PpcImportAction::Return(ppc_i16_result(
ppc_close_component(cpu, quicktime),
))),
PpcImportDispatcherTarget::NewRoutineDescriptor
| PpcImportDispatcherTarget::NewIOCompletionUPP
| PpcImportDispatcherTarget::DisposeIOCompletionUPP
| PpcImportDispatcherTarget::NewControlUserPaneDrawUPP
| PpcImportDispatcherTarget::DisposeControlUserPaneDrawUPP
| PpcImportDispatcherTarget::NewAEEventHandlerUPP
| PpcImportDispatcherTarget::DisposeAEEventHandlerUPP
| PpcImportDispatcherTarget::NewFatRoutineDescriptor
| PpcImportDispatcherTarget::DisposeRoutineDescriptor
| PpcImportDispatcherTarget::CallUniversalProc
| PpcImportDispatcherTarget::CallOSTrapUniversalProc => {
unreachable!("mixed mode imports return through dispatch_mixed_mode_import")
}
PpcImportDispatcherTarget::NGetTrapAddress
| PpcImportDispatcherTarget::GetToolTrapAddress
| PpcImportDispatcherTarget::GetOSTrapAddress => {
let trap_word = cpu.gpr[3] as u16;
let toolbox = matches!(
binding.dispatcher_target,
PpcImportDispatcherTarget::GetToolTrapAddress
) || (matches!(
binding.dispatcher_target,
PpcImportDispatcherTarget::NGetTrapAddress
) && cpu.gpr[4] != 0);
Some(PpcImportAction::Return(
ppc_logical_trap_address(memory, trap_word, toolbox).unwrap_or(0),
))
}
PpcImportDispatcherTarget::SetToolTrapAddress
| PpcImportDispatcherTarget::SetOSTrapAddress
| PpcImportDispatcherTarget::NSetTrapAddress => {
let toolbox = matches!(
binding.dispatcher_target,
PpcImportDispatcherTarget::SetToolTrapAddress
) || (matches!(
binding.dispatcher_target,
PpcImportDispatcherTarget::NSetTrapAddress
) && cpu.gpr[5] != 0);
Some(
if ppc_set_logical_trap_address(memory, cpu.gpr[4] as u16, toolbox, cpu.gpr[3]) {
PpcImportAction::ReturnPreserve
} else {
PpcImportAction::Halt
},
)
}
PpcImportDispatcherTarget::LegacyMemoryUtility(operation) => {
ppc_dispatch_legacy_memory_utility(
operation,
cpu,
process_memory_manager,
memory,
heap_cursor,
heap_limit,
last_mem_error,
handles,
)
}
PpcImportDispatcherTarget::LegacyControl(_) => {
unreachable!("control imports return through dispatch_control_import")
}
PpcImportDispatcherTarget::LegacyWindow(_) => {
unreachable!("window imports return through dispatch_window_import")
}
PpcImportDispatcherTarget::AppleEventCompatibility(_) => {
unreachable!("Apple Event imports return through dispatch_apple_event_import")
}
PpcImportDispatcherTarget::DialogCompatibility(_) => {
unreachable!("dialog imports return through dispatch_dialog_import")
}
PpcImportDispatcherTarget::QuickDrawCompatibility(operation) => {
Some(dispatch_quickdraw::ppc_dispatch_quickdraw_compatibility(
operation,
cpu,
process_memory_manager,
memory,
heap_cursor,
heap_limit,
last_mem_error,
handles,
vfs_resources,
*current_resource_refnum,
gworlds,
*current_gworld,
*current_gdevice,
screen_clut,
color_manager_clut,
*quickdraw_fore_color,
quickdraw_fore_indices.get(current_gworld).copied(),
*quickdraw_back_color,
toolbox_startup,
))
}
PpcImportDispatcherTarget::SystemCompatibility(operation) => Some(dispatch_system::ppc_dispatch_system_compatibility(
operation,
cpu,
process_memory_manager,
memory,
heap_cursor,
heap_limit,
last_mem_error,
handles,
launched_app_path,
)),
PpcImportDispatcherTarget::AppleTalkCompatibility(operation) => {
Some(dispatch_appletalk::ppc_dispatch_appletalk_compatibility(operation, cpu, memory))
}
PpcImportDispatcherTarget::PrintingCompatibility(operation) => {
Some(dispatch_printing::ppc_dispatch_printing_compatibility(operation))
}
PpcImportDispatcherTarget::SlotCompatibility => {
Some(ppc_dispatch_slot_compatibility(binding, cpu, memory))
}
PpcImportDispatcherTarget::StandardFileCompatibility(_) => {
unreachable!("standard file imports return through dispatch_standard_file_import")
}
PpcImportDispatcherTarget::SysBeep
| PpcImportDispatcherTarget::SndSoundManagerVersion
| PpcImportDispatcherTarget::UnsignedFixedMulDiv
| PpcImportDispatcherTarget::GetSoundOutputInfo
| PpcImportDispatcherTarget::GetCompressionInfo
| PpcImportDispatcherTarget::GetSoundVol
| PpcImportDispatcherTarget::SetSoundVol
| PpcImportDispatcherTarget::GetDefaultOutputVolume
| PpcImportDispatcherTarget::SetDefaultOutputVolume
| PpcImportDispatcherTarget::SndNewChannel
| PpcImportDispatcherTarget::SndDisposeChannel
| PpcImportDispatcherTarget::SndPlay
| PpcImportDispatcherTarget::SndChannelStatus
| PpcImportDispatcherTarget::SndGetInfo
| PpcImportDispatcherTarget::SndSetInfo
| PpcImportDispatcherTarget::ParseSndHeader
| PpcImportDispatcherTarget::SndDoCommand
| PpcImportDispatcherTarget::SndDoImmediate
| PpcImportDispatcherTarget::SndPlayDoubleBuffer
| PpcImportDispatcherTarget::SndStartFilePlay
| PpcImportDispatcherTarget::SndPauseFilePlay
| PpcImportDispatcherTarget::SndStopFilePlay
| PpcImportDispatcherTarget::GetSoundHeaderOffset
| PpcImportDispatcherTarget::SoundInputCompatibility(_) => {
unreachable!("sound imports return through dispatch_sound_import")
}
PpcImportDispatcherTarget::SpeechCompatibility(operation) => {
Some(ppc_dispatch_speech_compatibility(operation, cpu, memory))
}
PpcImportDispatcherTarget::QuickTimeCompatibility(operation) => Some(
dispatch_quicktime_compatibility(operation, cpu, memory, quicktime),
),
PpcImportDispatcherTarget::InputSprocketCompatibility(_) => {
unreachable!("input sprocket compatibility imports return through dispatch_inputsprocket_import")
}
PpcImportDispatcherTarget::MathCompatibility(operation) => {
Some(ppc_dispatch_math_compatibility(operation, cpu, memory))
}
PpcImportDispatcherTarget::Math64(operation) => {
Some(ppc_dispatch_math64(operation, cpu, memory))
}
PpcImportDispatcherTarget::StdCCompatibility(_) => {
unreachable!("stdc imports return through dispatch_stdc_import")
}
PpcImportDispatcherTarget::ObjectSupportCompatibility => {
Some(ppc_dispatch_object_support_compatibility(
cpu,
process_memory_manager,
memory,
heap_cursor,
heap_limit,
last_mem_error,
handles,
))
}
PpcImportDispatcherTarget::GlideSstQueryBoards => {
Some(PpcImportAction::Return(0))
}
PpcImportDispatcherTarget::FlushEvents
| PpcImportDispatcherTarget::SetEventMask
| PpcImportDispatcherTarget::GetNextEvent(_)
| PpcImportDispatcherTarget::GetOSEvent
| PpcImportDispatcherTarget::EventAvail
| PpcImportDispatcherTarget::OSEventAvail
| PpcImportDispatcherTarget::PostEvent
| PpcImportDispatcherTarget::Button
| PpcImportDispatcherTarget::StillDown
| PpcImportDispatcherTarget::WaitMouseUp
| PpcImportDispatcherTarget::GetKeys
| PpcImportDispatcherTarget::GetMouse => {
unreachable!("event imports return through dispatch_event_import")
}
PpcImportDispatcherTarget::LMGetMenuList
| PpcImportDispatcherTarget::LMSetMenuHook
| PpcImportDispatcherTarget::LMGetMenuFlash
| PpcImportDispatcherTarget::LMGetPaintWhite
| PpcImportDispatcherTarget::LMGetSysMap
| PpcImportDispatcherTarget::LMGetCurApRefNum
| PpcImportDispatcherTarget::GetVCBQHdr
| PpcImportDispatcherTarget::LMGetSysEvtMask
| PpcImportDispatcherTarget::LMSetSysEvtMask
| PpcImportDispatcherTarget::LMGetDefltStack
| PpcImportDispatcherTarget::LMGetCurStackBase
| PpcImportDispatcherTarget::LMSetPaintWhite
| PpcImportDispatcherTarget::LMSetResumeProc
| PpcImportDispatcherTarget::LMSetACount
| PpcImportDispatcherTarget::LMSetANumber
| PpcImportDispatcherTarget::LMSetDlgFont
| PpcImportDispatcherTarget::SetMenuFlash
| PpcImportDispatcherTarget::GetGrayRgn
| PpcImportDispatcherTarget::LMSetGrayRgn
| PpcImportDispatcherTarget::LMGetUTableBase
| PpcImportDispatcherTarget::LMGetCurDirStore
| PpcImportDispatcherTarget::LMSetCurDirStore
| PpcImportDispatcherTarget::LMGetSFSaveDisk
| PpcImportDispatcherTarget::LMSetSFSaveDisk
| PpcImportDispatcherTarget::LMGetRndSeed
| PpcImportDispatcherTarget::LMSetRndSeed
| PpcImportDispatcherTarget::SetCurrentA5
| PpcImportDispatcherTarget::SetA5
| PpcImportDispatcherTarget::LMGetCurrentA5 => {
unreachable!("low-memory imports return through dispatch_low_memory_import")
}
PpcImportDispatcherTarget::TickCount
| PpcImportDispatcherTarget::GetDateTime
| PpcImportDispatcherTarget::ReadDateTime
| PpcImportDispatcherTarget::ReadLocation
| PpcImportDispatcherTarget::GetTime
| PpcImportDispatcherTarget::Delay
| PpcImportDispatcherTarget::GetDblTime
| PpcImportDispatcherTarget::LMGetTime
| PpcImportDispatcherTarget::SecondsToDate
| PpcImportDispatcherTarget::Microseconds
| PpcImportDispatcherTarget::AbsoluteToNanoseconds => {
unreachable!("time imports return through dispatch_time_import")
}
PpcImportDispatcherTarget::ReturnError(error) => {
Some(PpcImportAction::Return(ppc_i16_result(error)))
}
PpcImportDispatcherTarget::ReturnNoErr => Some(PpcImportAction::Return(0)),
PpcImportDispatcherTarget::ReturnOne => Some(PpcImportAction::Return(1)),
PpcImportDispatcherTarget::NoOpPreserve => Some(PpcImportAction::ReturnPreserve),
PpcImportDispatcherTarget::ExitToShell => Some(PpcImportAction::Halt),
PpcImportDispatcherTarget::UnresolvedWeak | PpcImportDispatcherTarget::Unsupported => None,
}
}
pub(crate) fn ppc_zero_guest_bytes(memory: &mut PpcSectionMem, addr: u32, len: u32) -> bool {
if addr == 0 || !ppc_memory_can_write_bytes(memory, addr, len) {
return false;
}
for offset in 0..len {
if memory.write_u8(addr + offset, 0).is_none() {
return false;
}
}
true
}
fn ppc_dispatch_slot_compatibility(
_binding: &PpcImportBinding,
cpu: &mut PpcCpu,
memory: &mut PpcSectionMem,
) -> PpcImportAction {
if cpu.gpr[3] != 0 {
let _ = memory.write_u32_be(cpu.gpr[3], 0);
}
PpcImportAction::Return(ppc_i16_result(PPC_SM_NO_MORE_SRSRCS_ERR))
}
mod math_compatibility;
use math_compatibility::*;
fn ppc_math_ceil(cpu: &mut PpcCpu) {
const EXPONENT_MASK: u64 = 0x7ff0_0000_0000_0000;
const FRACTION_MASK: u64 = 0x000f_ffff_ffff_ffff;
const QUIET_NAN_BIT: u64 = 0x0008_0000_0000_0000;
let bits = cpu.fpr[1];
let signaling_nan = bits & EXPONENT_MASK == EXPONENT_MASK
&& bits & FRACTION_MASK != 0
&& bits & QUIET_NAN_BIT == 0;
if signaling_nan {
cpu.fpr[1] = bits | QUIET_NAN_BIT;
cpu.set_fpscr_bit(0, true);
cpu.set_fpscr_bit(2, true);
cpu.set_fpscr_bit(7, true);
if cpu.fpscr_bit(24) {
cpu.set_fpscr_bit(1, true);
}
} else {
cpu.fpr[1] = f64::from_bits(bits).ceil().to_bits();
}
}
fn ppc_math_fmod(cpu: &mut PpcCpu) {
let dividend = f64::from_bits(cpu.fpr[1]);
let divisor = f64::from_bits(cpu.fpr[2]);
cpu.fpr[1] = (dividend % divisor).to_bits();
}
#[allow(clippy::too_many_arguments)]
fn ppc_dispatch_object_support_compatibility(
cpu: &mut PpcCpu,
process_memory_manager: &mut ProcessNativeMemoryManager,
memory: &mut PpcSectionMem,
heap_cursor: &mut u32,
heap_limit: u32,
last_mem_error: &mut i16,
handles: &mut Vec<PpcHandleRecord>,
) -> PpcImportAction {
let result_ptr = cpu.gpr[8];
if result_ptr == 0 || !ppc_memory_can_write_bytes(memory, result_ptr, 8) {
return PpcImportAction::Return(ppc_i16_result(PPC_PARAM_ERR));
}
let mut data = Vec::with_capacity(12);
data.extend_from_slice(&cpu.gpr[3].to_be_bytes());
data.extend_from_slice(&cpu.gpr[5].to_be_bytes());
data.extend_from_slice(&cpu.gpr[6].to_be_bytes());
let result = ppc_create_process_owned_ae_desc(
process_memory_manager,
memory,
heap_cursor,
heap_limit,
last_mem_error,
handles,
None,
result_ptr,
u32::from_be_bytes(*b"obj "),
&data,
);
PpcImportAction::Return(ppc_i16_result(result))
}
fn ppc_math_dtox80(cpu: &PpcCpu, memory: &mut PpcSectionMem) -> bool {
let Some(hi) = memory.read_u32_be(cpu.gpr[3]) else {
return false;
};
let Some(lo) = memory.read_u32_be(cpu.gpr[3].wrapping_add(4)) else {
return false;
};
let extended = Extended80::from(f64::from_bits((u64::from(hi) << 32) | u64::from(lo)));
let sign_bit = if extended.sign { 0x8000 } else { 0 };
let out = cpu.gpr[4];
memory
.write_u16_be(out, sign_bit | extended.exponent)
.is_some()
&& memory
.write_u16_be(out.wrapping_add(2), (extended.significand >> 48) as u16)
.is_some()
&& memory
.write_u16_be(out.wrapping_add(4), (extended.significand >> 32) as u16)
.is_some()
&& memory
.write_u16_be(out.wrapping_add(6), (extended.significand >> 16) as u16)
.is_some()
&& memory
.write_u16_be(out.wrapping_add(8), extended.significand as u16)
.is_some()
}
fn ppc_virtual_microseconds(
tick_count: u32,
cycles_per_tick: u32,
cycle_phase: u32,
elapsed_cycles: u64,
) -> u64 {
let cycles_per_tick = u64::from(cycles_per_tick.max(1));
let elapsed_cycles = u64::from(cycle_phase).saturating_add(elapsed_cycles);
u64::from(tick_count)
.saturating_mul(PPC_MICROSECONDS_PER_TICK)
.saturating_add(elapsed_cycles.saturating_mul(PPC_MICROSECONDS_PER_TICK) / cycles_per_tick)
}
fn ppc_virtual_tick_count(
tick_count: u32,
cycles_per_tick: u32,
cycle_phase: u32,
elapsed_cycles: u64,
) -> u32 {
let cycles_per_tick = u64::from(cycles_per_tick.max(1));
let elapsed_cycles = u64::from(cycle_phase).saturating_add(elapsed_cycles);
tick_count.wrapping_add((elapsed_cycles / cycles_per_tick) as u32)
}
fn ppc_cycles_until_next_tick(cycles_per_tick: u32, cycle_phase: u32, elapsed_cycles: u64) -> u64 {
let cycles_per_tick = u64::from(cycles_per_tick.max(1));
let cycle_phase = u64::from(cycle_phase).saturating_add(elapsed_cycles) % cycles_per_tick;
cycles_per_tick - cycle_phase
}
fn dispatch_simple_hot_import_fast(
target: &PpcImportDispatcherTarget,
cpu: &mut PpcCpu,
memory: &mut PpcSectionMem,
microseconds: u64,
) -> Option<PpcImportAction> {
match target {
PpcImportDispatcherTarget::Microseconds => {
Some(dispatch_microseconds_import(cpu, memory, microseconds, None))
}
PpcImportDispatcherTarget::AbsoluteToNanoseconds => {
let output = cpu.gpr[3];
let absolute = (u64::from(cpu.gpr[4]) << 32) | u64::from(cpu.gpr[5]);
if output != 0 && ppc_memory_can_write_bytes(memory, output, 8) {
let _ = memory.write_u64_be(output, absolute.saturating_mul(1_000));
}
Some(PpcImportAction::ReturnPreserve)
}
_ => dispatch_math::dispatch_math_import(target, cpu, memory),
}
}
pub(super) fn ppc_random(memory: &mut PpcSectionMem) -> u16 {
let old_seed = memory.read_u32_be(PPC_RAND_SEED_ADDR).unwrap_or(1);
let seed = if old_seed == 0 { 1 } else { old_seed };
let new_seed = ((u64::from(seed) * 16_807) % 2_147_483_647) as u32;
let _ = memory.write_u32_be(PPC_RAND_SEED_ADDR, new_seed);
let result = new_seed as u16;
if result == 0x8000 {
0
} else {
result
}
}
fn ppc_string_to_num(cpu: &PpcCpu, memory: &mut PpcSectionMem) {
let string_ptr = cpu.gpr[3];
let number_ptr = cpu.gpr[4];
if string_ptr == 0 || number_ptr == 0 || !ppc_memory_can_write_bytes(memory, number_ptr, 4) {
return;
}
let Some(bytes) = ppc_read_pstring_bytes(memory, string_ptr) else {
return;
};
let mut index = 0usize;
while bytes
.get(index)
.is_some_and(|byte| byte.is_ascii_whitespace())
{
index += 1;
}
let mut sign = 1i64;
if let Some(byte) = bytes.get(index) {
if *byte == b'-' {
sign = -1;
index += 1;
} else if *byte == b'+' {
index += 1;
}
}
let mut value = 0i64;
while let Some(byte) = bytes.get(index) {
if !byte.is_ascii_digit() {
break;
}
value = value
.saturating_mul(10)
.saturating_add(i64::from(byte - b'0'));
index += 1;
}
let signed = value
.saturating_mul(sign)
.clamp(i32::MIN as i64, i32::MAX as i64) as i32;
let _ = memory.write_u32_be(number_ptr, signed as u32);
}
pub(crate) fn ppc_rgb555_to_rgb16(pixel: u16) -> [u16; 3] {
fn component(value: u16) -> u16 {
(((u32::from(value) * 65_535) + 15) / 31) as u16
}
[
component((pixel >> 10) & 0x1f),
component((pixel >> 5) & 0x1f),
component(pixel & 0x1f),
]
}
pub(crate) fn ppc_rgb555_to_clut_index(pixel: u16, clut: &[[u16; 3]; 256]) -> u8 {
let [red, green, blue] = ppc_rgb555_to_rgb16(pixel & 0x7fff);
pict::closest_clut_index(red, green, blue, clut)
}
fn ppc_draw_raw_quilt_frame(
memory: &mut PpcSectionMem,
front_buffer: PpcFrontBuffer,
data: &[u8],
pict_bounds: (i16, i16, i16, i16),
dst_rect: (i16, i16, i16, i16),
clut: &[[u16; 3]; 256],
zero_is_opaque: bool,
) -> bool {
if data.len() < 24 || data[10..24].iter().any(|byte| *byte != 0) {
return false;
}
let (src_top, src_left, src_bottom, src_right) = pict_bounds;
let src_width = i32::from(src_right) - i32::from(src_left);
let src_height = i32::from(src_bottom) - i32::from(src_top);
if src_width <= 0 || src_height <= 0 {
return false;
}
let raw = &data[24..];
let Ok(src_height_usize) = usize::try_from(src_height) else {
return false;
};
if src_height_usize == 0 || raw.len() % src_height_usize != 0 {
return false;
}
let src_row_bytes = raw.len() / src_height_usize;
let Ok(src_width_usize) = usize::try_from(src_width) else {
return false;
};
if src_row_bytes < src_width_usize {
return false;
}
let (dst_top, dst_left, dst_bottom, dst_right) = dst_rect;
let dst_width = i32::from(dst_right) - i32::from(dst_left);
let dst_height = i32::from(dst_bottom) - i32::from(dst_top);
if dst_width <= 0 || dst_height <= 0 {
return false;
}
let copy_top = i32::from(dst_top).max(0).min(front_buffer.height as i32);
let copy_bottom = i32::from(dst_bottom).max(0).min(front_buffer.height as i32);
let copy_left = i32::from(dst_left).max(0).min(front_buffer.width as i32);
let copy_right = i32::from(dst_right).max(0).min(front_buffer.width as i32);
if copy_bottom <= copy_top || copy_right <= copy_left {
return false;
}
for y in copy_top..copy_bottom {
let src_y =
((y - i32::from(dst_top)) * src_height / dst_height).clamp(0, src_height - 1) as usize;
for x in copy_left..copy_right {
let src_x = ((x - i32::from(dst_left)) * src_width / dst_width).clamp(0, src_width - 1)
as usize;
let Some(mut color_index) = raw
.get(src_y.saturating_mul(src_row_bytes).saturating_add(src_x))
.copied()
else {
continue;
};
if zero_is_opaque && color_index == 0 {
color_index = pict::closest_clut_index(0, 0, 0, clut);
}
if front_buffer.depth == 8 {
let Some(dst_addr) = front_buffer
.base_addr
.checked_add((y as u32).saturating_mul(front_buffer.row_bytes))
.and_then(|row| row.checked_add(x as u32))
else {
continue;
};
let _ = memory.write_u8(dst_addr, color_index);
} else if front_buffer.depth == 16 {
let [red, green, blue] = clut[color_index as usize];
let pixel = ppc_q3_rgb555((
f32::from(red) / 65_535.0,
f32::from(green) / 65_535.0,
f32::from(blue) / 65_535.0,
));
let _ = ppc_q3_write_software_pixel(memory, front_buffer, (x, y), pixel);
} else {
return false;
}
}
}
true
}
pub(super) fn ppc_draw_pict_bytes_to_16bpp(
memory: &mut PpcSectionMem,
front_buffer: PpcFrontBuffer,
data: &[u8],
dst_rect: (i16, i16, i16, i16),
clut: &[[u16; 3]; 256],
device_ct_seed: u32,
quilt_zero_is_opaque: bool,
) -> bool {
if front_buffer.base_addr == 0 || front_buffer.width == 0 || front_buffer.height == 0 {
return false;
}
let Some((pict_offset, bounds)) = ppc_qt_pict_record_offset_and_bounds(data) else {
return false;
};
let (dst_top, dst_left, dst_bottom, dst_right) = dst_rect;
if dst_bottom <= dst_top || dst_right <= dst_left {
return false;
}
let Ok(width) = u16::try_from(front_buffer.width) else {
return false;
};
let Ok(height) = u16::try_from(front_buffer.height) else {
return false;
};
if pict_offset == 0
&& ppc_draw_raw_quilt_frame(
memory,
front_buffer,
data,
bounds,
dst_rect,
clut,
quilt_zero_is_opaque,
)
{
return true;
}
if matches!(front_buffer.depth, 1 | 2 | 4 | 8) {
let Some(minimum_row_bytes) = front_buffer
.width
.checked_mul(front_buffer.depth)
.and_then(|bits| bits.checked_add(7))
.map(|bits| bits / 8)
else {
return false;
};
if front_buffer.row_bytes < minimum_row_bytes {
return false;
}
let row_bytes = front_buffer.row_bytes;
let Some(buffer_len) = row_bytes.checked_mul(front_buffer.height) else {
return false;
};
let Some(buffer_len_usize) = usize::try_from(buffer_len).ok() else {
return false;
};
let pict_base = 0x0001_0000u32;
let Some(pict_end) = pict_base.checked_add(u32::try_from(data.len()).unwrap_or(u32::MAX))
else {
return false;
};
let screen_base = (pict_end.saturating_add(0x0fff)) & !0x0fffu32;
let Some(screen_end) = screen_base.checked_add(buffer_len) else {
return false;
};
let Some(ram_size) = usize::try_from(screen_end.saturating_add(0x1000)).ok() else {
return false;
};
if ram_size > 128 * 1024 * 1024 {
return false;
}
let mut indexed = vec![0u8; buffer_len_usize];
for y in 0..front_buffer.height {
let Some(src_addr) = front_buffer
.base_addr
.checked_add(y.saturating_mul(front_buffer.row_bytes))
else {
return false;
};
let Some(dst_offset) = usize::try_from(y.saturating_mul(row_bytes)).ok() else {
return false;
};
let Some(row_len) = usize::try_from(row_bytes).ok() else {
return false;
};
if memory
.read_bytes_into(src_addr, &mut indexed[dst_offset..dst_offset + row_len])
.is_none()
{
return false;
}
}
let packed_clut = matches!(front_buffer.depth, 1 | 2 | 4).then(|| {
let mut packed_clut = *clut;
let entry_count = 1usize << front_buffer.depth;
let terminal = packed_clut[entry_count - 1];
packed_clut[entry_count..].fill(terminal);
packed_clut
});
let draw_clut = packed_clut.as_ref().unwrap_or(clut);
let mut bus = MacMemoryBus::new(ram_size);
bus.write_bytes(pict_base, data);
bus.write_bytes(screen_base, &indexed);
bus.begin_uncapped_write_probe();
let (rendered, _) = pict::draw_picture(
&mut bus,
pict_base + u32::try_from(pict_offset).unwrap_or(0),
dst_top,
dst_left,
dst_bottom,
dst_right,
(
screen_base,
row_bytes,
width,
height,
front_buffer.depth as u16,
),
draw_clut,
device_ct_seed,
None,
);
if !rendered {
return false;
}
return ppc_commit_picture_writes(memory, &mut bus, screen_base, front_buffer, buffer_len);
}
if front_buffer.depth != 16 || front_buffer.row_bytes < front_buffer.width.saturating_mul(2) {
return false;
}
let row_bytes = front_buffer.row_bytes;
let Some(buffer_len) = row_bytes.checked_mul(front_buffer.height) else {
return false;
};
let Some(buffer_len_usize) = usize::try_from(buffer_len).ok() else {
return false;
};
let pict_base = 0x0001_0000u32;
let Some(pict_end) = pict_base.checked_add(u32::try_from(data.len()).unwrap_or(u32::MAX))
else {
return false;
};
let screen_base = (pict_end.saturating_add(0x0fff)) & !0x0fffu32;
let Some(screen_end) = screen_base.checked_add(buffer_len) else {
return false;
};
let Some(ram_size) = usize::try_from(screen_end.saturating_add(0x1000)).ok() else {
return false;
};
if ram_size > 128 * 1024 * 1024 {
return false;
}
let mut direct = vec![0u8; buffer_len_usize];
for y in 0..front_buffer.height {
let Some(src_addr) = front_buffer
.base_addr
.checked_add(y.saturating_mul(front_buffer.row_bytes))
else {
return false;
};
let Some(dst_offset) = usize::try_from(y.saturating_mul(row_bytes)).ok() else {
return false;
};
let Some(row_len) = usize::try_from(row_bytes).ok() else {
return false;
};
if memory
.read_bytes_into(src_addr, &mut direct[dst_offset..dst_offset + row_len])
.is_none()
{
return false;
}
}
let mut bus = MacMemoryBus::new(ram_size);
bus.write_bytes(pict_base, data);
bus.write_bytes(screen_base, &direct);
bus.begin_uncapped_write_probe();
let (rendered, _) = pict::draw_picture(
&mut bus,
pict_base + u32::try_from(pict_offset).unwrap_or(0),
dst_top,
dst_left,
dst_bottom,
dst_right,
(screen_base, row_bytes, width, height, 16),
clut,
device_ct_seed,
None,
);
if !rendered {
return false;
}
ppc_commit_picture_writes(memory, &mut bus, screen_base, front_buffer, buffer_len)
}
fn ppc_commit_picture_writes(
memory: &mut PpcSectionMem,
bus: &mut MacMemoryBus,
screen_base: u32,
front_buffer: PpcFrontBuffer,
buffer_len: u32,
) -> bool {
for range in bus.finish_write_probe_ranges() {
let start = range.start.max(screen_base);
let end = range.end.min(screen_base + buffer_len);
if start < end {
let bytes = bus.read_bytes(start, (end - start) as usize);
if memory
.write_bytes(front_buffer.base_addr + start - screen_base, &bytes)
.is_none()
{
return false;
}
}
}
true
}
fn ppc_gestalt(
cpu: &mut PpcCpu,
memory: &mut PpcSectionMem,
toolbox_startup: &PpcToolboxStartupState,
) -> i16 {
let selector = cpu.gpr[3];
let response_ptr = cpu.gpr[4];
if response_ptr == 0 {
return PPC_PARAM_ERR;
}
let Some((response, err)) = ppc_gestalt_response(selector).or_else(|| {
toolbox_startup
.gestalt_values
.get(&selector)
.copied()
.map(|value| (value, PPC_NO_ERR))
}) else {
if ppc_hle_trace_enabled() {
eprintln!(
"[PPC-TRACE] Gestalt({:?}) -> gestaltUndefSelectorErr",
ppc_res_type_text(selector)
);
}
if memory.write_u32_be(response_ptr, 0).is_none() {
return PPC_PARAM_ERR;
}
return PPC_GESTALT_UNDEF_SELECTOR_ERR;
};
if memory.write_u32_be(response_ptr, response).is_none() {
return PPC_PARAM_ERR;
}
if ppc_hle_trace_enabled() {
eprintln!(
"[PPC-TRACE] Gestalt({:?}) -> ${response:08X} err={err} lr=${:08X}",
ppc_res_type_text(selector), cpu.lr
);
}
err
}
fn ppc_gestalt_response(selector: u32) -> Option<(u32, i16)> {
match &selector.to_be_bytes() {
b"vers" => Some((0x0001, PPC_NO_ERR)),
b"sysv" => Some((u32::from(POWERPC_SYSTEM_VERSION_BCD), PPC_NO_ERR)),
b"cbon" => Some((u32::from(POWERPC_CARBON_VERSION_BCD), PPC_NO_ERR)),
b"ostt" => Some((crate::trap::dispatch::OS_TRAP_TABLE_BASE, PPC_NO_ERR)),
b"tbtt" => Some((crate::trap::dispatch::TOOLBOX_TRAP_TABLE_BASE, PPC_NO_ERR)),
b"evnt" => Some((0x0001, PPC_NO_ERR)),
b"cput" => Some((
REFERENCE_POWERPC_EXECUTION_CAPABILITIES.native_cpu_type,
PPC_NO_ERR,
)),
b"sysa" => REFERENCE_POWERPC_EXECUTION_CAPABILITIES
.system_architecture
.map(|architecture| (architecture, PPC_NO_ERR)),
b"proc" => Some((
REFERENCE_POWERPC_EXECUTION_CAPABILITIES.processor_type,
PPC_NO_ERR,
)),
b"mach" => Some((
u32::from(REFERENCE_MACHINE_PROFILE.gestalt_machine_type),
PPC_NO_ERR,
)),
b"qd " => Some((0x0230, PPC_NO_ERR)),
b"qdrw" => Some((0x000F, PPC_NO_ERR)),
b"ram " => Some((REFERENCE_MACHINE_PROFILE.ram_size_bytes, PPC_NO_ERR)),
b"lram" => Some((REFERENCE_MACHINE_PROFILE.ram_size_bytes, PPC_NO_ERR)),
b"fpu " => Some((
REFERENCE_POWERPC_EXECUTION_CAPABILITIES.fpu_type,
PPC_NO_ERR,
)),
b"mmu " => Some((
REFERENCE_POWERPC_EXECUTION_CAPABILITIES.mmu_type,
PPC_NO_ERR,
)),
b"snd " => Some((0x1CFB, PPC_NO_ERR)),
b"tmgr" => Some((2, PPC_NO_ERR)),
b"thds" => Some((0b101, PPC_NO_ERR)),
b"dplv" => Some((0x0002_0006, PPC_NO_ERR)),
b"dply" => Some((0x0000_0007, PPC_NO_ERR)),
b"alis" => Some((1, PPC_NO_ERR)),
b"fs " => Some(((1 << 0) | (1 << 1), PPC_NO_ERR)),
b"fold" => Some((1, PPC_NO_ERR)),
b"qtim" => Some((PPC_QUICKTIME_VERSION, PPC_NO_ERR)),
b"drag" => Some((0, PPC_NO_ERR)),
b"os " => Some((0x00FF, PPC_NO_ERR)),
b"powr" => Some((0, PPC_NO_ERR)),
b"appr" => Some((1, PPC_NO_ERR)),
b"addr" => Some((0b111, PPC_NO_ERR)),
b"sdev" => Some((0, PPC_NO_ERR)),
b"stdf" => Some((1, PPC_NO_ERR)),
b"help" => Some((1, PPC_NO_ERR)),
b"vm " => Some((0, PPC_NO_ERR)),
b"cfrg" => Some((1, PPC_NO_ERR)),
b"mixd" => Some((1, PPC_NO_ERR)),
b"qd3d" => Some((1, PPC_NO_ERR)),
b"q3v " => Some((PPC_QD3D_VERSION, PPC_NO_ERR)),
b"a/ux" => Some((0, PPC_GESTALT_UNDEF_SELECTOR_ERR)),
_ => None,
}
}
pub(super) fn ppc_write_pstring_bytes(memory: &mut PpcSectionMem, addr: u32, bytes: &[u8]) -> bool {
let len = bytes.len().min(255);
if memory.write_u8(addr, len as u8).is_none() {
return false;
}
for (offset, byte) in bytes.iter().copied().take(len).enumerate() {
let Some(byte_addr) = addr.checked_add(1 + offset as u32) else {
return false;
};
if memory.write_u8(byte_addr, byte).is_none() {
return false;
}
}
true
}
pub(super) fn minimal_pict_bytes() -> [u8; 12] {
[
0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xff, ]
}
fn ppc_get_pict_info(cpu: &mut PpcCpu, memory: &mut PpcSectionMem) -> i16 {
let _pic_handle = cpu.gpr[3];
let pict_info_ptr = cpu.gpr[4];
if pict_info_ptr == 0 || !ppc_memory_can_write_bytes(memory, pict_info_ptr, PPC_PICT_INFO_SIZE)
{
return PPC_PARAM_ERR;
}
for offset in 0..PPC_PICT_INFO_SIZE {
if memory.write_u8(pict_info_ptr + offset, 0).is_none() {
return PPC_PARAM_ERR;
}
}
PPC_NO_ERR
}
fn ppc_new_pixmap(
process_memory_manager: &mut ProcessNativeMemoryManager,
memory: &mut PpcSectionMem,
heap_cursor: &mut u32,
heap_limit: u32,
last_mem_error: &mut i16,
handles: &mut Vec<PpcHandleRecord>,
current_gdevice: u32,
) -> u32 {
let source_pixmap = memory
.read_u32_be(current_gdevice)
.filter(|device| *device != 0)
.and_then(|device| memory.read_u32_be(device.checked_add(22)?))
.filter(|handle| *handle != 0)
.and_then(|handle| memory.read_u32_be(handle))
.filter(|pixmap| *pixmap != 0)
.unwrap_or(PPC_MAIN_PIXMAP);
let Some(mut pixmap_bytes) = ppc_memory_read_bytes(memory, source_pixmap, PPC_PIXMAP_SIZE)
else {
*last_mem_error = PPC_PARAM_ERR;
return 0;
};
let ctable_bytes = [0; 8];
let ctable_size = u32::try_from(ctable_bytes.len()).unwrap_or(u32::MAX);
if !ppc_heap_can_alloc_sequence(
memory,
*heap_cursor,
heap_limit,
&[4, ctable_size, 4, PPC_PIXMAP_SIZE],
) {
*last_mem_error = PPC_MEM_FULL_ERR;
return 0;
}
let ctable_handle = ppc_process_alloc_handle_with_bytes(
process_memory_manager,
memory,
heap_cursor,
last_mem_error,
handles,
&ctable_bytes,
);
let pixmap_handle = ppc_process_alloc_handle(
process_memory_manager,
memory,
heap_cursor,
last_mem_error,
handles,
PPC_PIXMAP_SIZE,
true,
);
if ctable_handle == 0 || pixmap_handle == 0 {
*last_mem_error = PPC_MEM_FULL_ERR;
return 0;
}
pixmap_bytes[0..4].copy_from_slice(&0u32.to_be_bytes());
pixmap_bytes[22..26].copy_from_slice(&0x0048_0000u32.to_be_bytes());
pixmap_bytes[26..30].copy_from_slice(&0x0048_0000u32.to_be_bytes());
pixmap_bytes[42..46].copy_from_slice(&ctable_handle.to_be_bytes());
let Some(pixmap) = memory.read_u32_be(pixmap_handle) else {
*last_mem_error = PPC_PARAM_ERR;
return 0;
};
if memory.write_bytes(pixmap, &pixmap_bytes).is_none() {
*last_mem_error = PPC_PARAM_ERR;
return 0;
}
*last_mem_error = PPC_NO_ERR;
pixmap_handle
}
fn ppc_dispose_pixmap(
pixmap_handle: u32,
process_memory_manager: &mut ProcessNativeMemoryManager,
memory: &mut PpcSectionMem,
heap_cursor: &mut u32,
heap_limit: u32,
last_mem_error: &mut i16,
handles: &mut Vec<PpcHandleRecord>,
indexed_screen_ctables: &mut HashMap<u32, u32>,
) {
if pixmap_handle == 0 {
return;
}
let ctable_handle = memory
.read_u32_be(pixmap_handle)
.filter(|pixmap| *pixmap != 0)
.and_then(|pixmap| memory.read_u32_be(pixmap + 42))
.filter(|handle| *handle != 0)
.or_else(|| indexed_screen_ctables.remove(&pixmap_handle))
.unwrap_or(0);
if ctable_handle != 0 {
let _ = ppc_dispose_process_native_handle(
process_memory_manager,
memory,
heap_cursor,
heap_limit,
last_mem_error,
handles,
ctable_handle,
);
indexed_screen_ctables.retain(|_, handle| *handle != ctable_handle);
}
indexed_screen_ctables.remove(&pixmap_handle);
let _ = ppc_dispose_process_native_handle(
process_memory_manager,
memory,
heap_cursor,
heap_limit,
last_mem_error,
handles,
pixmap_handle,
);
}
fn ppc_text_width(
cpu: &mut PpcCpu,
memory: &mut PpcSectionMem,
text_font: i16,
text_size: i16,
text_face: u8,
) -> u32 {
let text_ptr = cpu.gpr[3];
let first_byte = cpu.gpr[4];
let byte_count = cpu.gpr[5];
let mut bytes = Vec::with_capacity(byte_count.min(i16::MAX as u32) as usize);
for offset in 0..byte_count {
let Some(addr) = text_ptr
.checked_add(first_byte)
.and_then(|base| base.checked_add(offset))
else {
break;
};
bytes.push(memory.read_u8(addr).unwrap_or(0));
}
ppc_text_width_bytes(text_font, text_size, text_face, &bytes).max(0) as u32
}
fn ppc_get_font_info(memory: &mut PpcSectionMem, info_ptr: u32, text_font: i16, text_size: i16) {
if info_ptr == 0 || !ppc_memory_can_write_bytes(memory, info_ptr, 8) {
return;
}
let (face, numerator, denominator) = get_font_face_scale_ratio(text_font, text_size);
let metrics = face.metrics;
let _ = memory.write_u16_be(
info_ptr,
ppc_scale_font_value(i32::from(metrics.ascent), numerator, denominator) as u16,
);
let _ = memory.write_u16_be(
info_ptr + 2,
ppc_scale_font_value(i32::from(metrics.descent), numerator, denominator) as u16,
);
let _ = memory.write_u16_be(
info_ptr + 4,
ppc_scale_font_value(i32::from(metrics.wid_max), numerator, denominator) as u16,
);
let _ = memory.write_u16_be(
info_ptr + 6,
ppc_scale_font_value(i32::from(metrics.leading), numerator, denominator) as u16,
);
}
fn ppc_font_metrics(memory: &mut PpcSectionMem, metrics_ptr: u32, text_font: i16, text_size: i16) {
if metrics_ptr == 0 || !ppc_memory_can_write_bytes(memory, metrics_ptr, 20) {
return;
}
let (face, numerator, denominator) = get_font_face_scale_ratio(text_font, text_size);
let metrics = face.metrics;
let to_fixed = |value: i16| -> u32 { (i32::from(value) as u32) << 16 };
let _ = memory.write_u32_be(
metrics_ptr,
to_fixed(ppc_scale_font_value(
i32::from(metrics.ascent),
numerator,
denominator,
)),
);
let _ = memory.write_u32_be(
metrics_ptr + 4,
to_fixed(ppc_scale_font_value(
i32::from(metrics.descent),
numerator,
denominator,
)),
);
let _ = memory.write_u32_be(
metrics_ptr + 8,
to_fixed(ppc_scale_font_value(
i32::from(metrics.leading),
numerator,
denominator,
)),
);
let _ = memory.write_u32_be(
metrics_ptr + 12,
to_fixed(ppc_scale_font_value(
i32::from(metrics.wid_max),
numerator,
denominator,
)),
);
let _ = memory.write_u32_be(metrics_ptr + 16, 0);
}
fn ppc_f64_to_fixed(value: f64) -> u32 {
(value * 65536.0)
.round()
.clamp(i32::MIN as f64, i32::MAX as f64) as i32 as u32
}
fn ppc_sys_environs(memory: &mut PpcSectionMem, rec_ptr: u32) -> i16 {
if rec_ptr < 0x100 || !ppc_memory_can_write_bytes(memory, rec_ptr, 16) {
return PPC_PARAM_ERR;
}
let _ = memory.write_u16_be(rec_ptr, 2);
let _ = memory.write_u16_be(rec_ptr + 2, REFERENCE_MACHINE_PROFILE.gestalt_machine_type);
let _ = memory.write_u16_be(rec_ptr + 4, POWERPC_SYSTEM_VERSION_BCD);
let _ = memory.write_u16_be(
rec_ptr + 6,
REFERENCE_MACHINE_PROFILE.gestalt_processor_type as u16,
);
let _ = memory.write_u8(rec_ptr + 8, u8::from(REFERENCE_MACHINE_PROFILE.has_fpu()));
let _ = memory.write_u8(rec_ptr + 9, 1);
let _ = memory.write_u16_be(rec_ptr + 10, 0);
let _ = memory.write_u16_be(rec_ptr + 12, 0);
let _ = memory.write_u16_be(rec_ptr + 14, 0);
PPC_NO_ERR
}
#[cfg(test)]
fn ppc_raw_trap_table_entry(trap_word: u16, toolbox: bool) -> u32 {
let kind = if toolbox {
TrapTableKind::Toolbox
} else {
TrapTableKind::OperatingSystem
};
TrapManager::table_address(trap_word, kind)
}
fn ppc_logical_trap_address(
memory: &mut PpcSectionMem,
trap_word: u16,
toolbox: bool,
) -> Option<u32> {
let kind = if toolbox {
TrapTableKind::Toolbox
} else {
TrapTableKind::OperatingSystem
};
let protected_memory = memory.shared_view();
TrapManager::get_address_with_provenance(
trap_word,
kind,
|operation| match operation {
TrapManagerMemoryOp::ReadLong(address) => {
Some(TrapManagerMemoryResult::Long(memory.read_u32_be(address)?))
}
TrapManagerMemoryOp::WriteLong { .. }
| TrapManagerMemoryOp::WriteProtectedLong { .. } => None,
},
move |address| protected_memory.is_shared_readonly_range(address, 4),
)
}
fn ppc_live_trap_import_action(
target: &PpcImportDispatcherTarget,
default_gateways: &HashMap<u16, u32>,
cpu: &mut PpcCpu,
process_memory_manager: &mut ProcessNativeMemoryManager,
memory: &mut PpcSectionMem,
toolbox_startup: &mut PpcToolboxStartupState,
) -> Result<Option<PpcImportAction>, ()> {
let (trap_word, toolbox, proc_info, argument_count) = match target {
PpcImportDispatcherTarget::StillDown => (0xA973, true, 0x10, 0),
PpcImportDispatcherTarget::Button => (0xA974, true, 0x10, 0),
PpcImportDispatcherTarget::TickCount => (0xA975, true, 0x30, 0),
PpcImportDispatcherTarget::GetKeys => (0xA976, true, 0xC0, 1),
PpcImportDispatcherTarget::WaitMouseUp => (0xA977, true, 0x10, 0),
_ => return Ok(None),
};
let kind = if toolbox {
TrapTableKind::Toolbox
} else {
TrapTableKind::OperatingSystem
};
let table_entry = TrapManager::table_address(trap_word, kind);
if memory.read_u32_be(table_entry).is_none() {
return Ok(None);
}
let handler = ppc_logical_trap_address(memory, trap_word, toolbox).ok_or(())?;
let canonical_word = crate::trap::manager::raw_trap_route(trap_word).canonical_word;
if default_gateways.get(&canonical_word) == Some(&handler) {
return Ok(None);
}
if handler == 0 {
return if default_gateways.is_empty() {
Ok(None)
} else {
Err(())
};
}
let heap = process_memory_manager
.native_heap_state()
.ok_or(())?;
if argument_count > 6 {
return Err(());
}
let mut saved_arguments = [0; 8];
saved_arguments.copy_from_slice(&cpu.gpr[3..11]);
for index in (0..argument_count).rev() {
cpu.gpr[5 + index] = saved_arguments[index];
}
cpu.gpr[3] = handler;
cpu.gpr[4] = proc_info;
let mut heap_cursor = heap.heap_cursor;
let heap_limit = process_memory_manager.native_allocation_limit(heap.heap_limit);
let action = ppc_call_universal_proc(
cpu,
process_memory_manager,
memory,
&mut heap_cursor,
heap_limit,
toolbox_startup,
GuestIsa::M68k,
);
if action.is_none() {
cpu.gpr[3..11].copy_from_slice(&saved_arguments);
return Err(());
}
Ok(action)
}
fn ppc_set_logical_trap_address(
memory: &mut PpcSectionMem,
trap_word: u16,
toolbox: bool,
handler: u32,
) -> bool {
let kind = if toolbox {
TrapTableKind::Toolbox
} else {
TrapTableKind::OperatingSystem
};
let protected_memory = memory.shared_view();
let result = TrapManager::set_address_with_provenance(
trap_word,
kind,
handler,
|operation| match operation {
TrapManagerMemoryOp::ReadLong(address) => {
Some(TrapManagerMemoryResult::Long(memory.read_u32_be(address)?))
}
TrapManagerMemoryOp::WriteLong { address, value } => memory
.write_u32_be(address, value)
.map(|()| TrapManagerMemoryResult::Written),
TrapManagerMemoryOp::WriteProtectedLong { address, value } => memory
.write_shared_system_u32_be(address, value)
.map(|()| TrapManagerMemoryResult::Written),
},
move |address| protected_memory.is_shared_readonly_range(address, 4),
);
if matches!(result, Err(TrapManagerSetError::InvalidComeFromHead)) {
let _ = memory.write_u16_be(crate::memory::globals::addr::DS_ERR_CODE, 12);
}
result.is_ok()
}
pub(super) fn ppc_write_rect(
memory: &mut PpcSectionMem,
rect_ptr: u32,
top: i16,
left: i16,
bottom: i16,
right: i16,
) -> Option<()> {
memory.write_u16_be(rect_ptr, top as u16)?;
memory.write_u16_be(rect_ptr + 2, left as u16)?;
memory.write_u16_be(rect_ptr + 4, bottom as u16)?;
memory.write_u16_be(rect_ptr + 6, right as u16)?;
Some(())
}
pub(super) fn ppc_read_rect(memory: &mut PpcSectionMem, rect_ptr: u32) -> Option<(i16, i16, i16, i16)> {
let top = memory.read_u16_be(rect_ptr)? as i16;
let left = memory.read_u16_be(rect_ptr + 2)? as i16;
let bottom = memory.read_u16_be(rect_ptr + 4)? as i16;
let right = memory.read_u16_be(rect_ptr + 6)? as i16;
Some((top, left, bottom, right))
}
pub(super) fn ppc_read_pstring(memory: &mut PpcSectionMem, addr: u32) -> Option<String> {
Some(decode_mac_roman(&ppc_read_pstring_bytes(memory, addr)?))
}
fn ppc_equal_string(cpu: &PpcCpu, memory: &mut PpcSectionMem) -> u32 {
let a_ptr = cpu.gpr[3];
let b_ptr = cpu.gpr[4];
let case_sensitive = (cpu.gpr[5] & 0xff) != 0;
let _diac_sensitive = (cpu.gpr[6] & 0xff) != 0;
let Some(a_bytes) = ppc_read_pstring_bytes(memory, a_ptr) else {
return 0;
};
let Some(b_bytes) = ppc_read_pstring_bytes(memory, b_ptr) else {
return 0;
};
let equal = if case_sensitive {
a_bytes == b_bytes
} else {
a_bytes.eq_ignore_ascii_case(&b_bytes)
};
if ppc_hle_trace_enabled() {
eprintln!(
"[PPC-TRACE] EqualString a={:?} b={:?} case_sensitive={} -> {}",
decode_mac_roman(&a_bytes),
decode_mac_roman(&b_bytes),
case_sensitive,
equal
);
}
u32::from(equal)
}
pub(super) fn ppc_read_pstring_bytes(memory: &mut PpcSectionMem, addr: u32) -> Option<Vec<u8>> {
let len = memory.read_u8(addr)? as usize;
let mut bytes = Vec::with_capacity(len);
for offset in 0..len {
bytes.push(memory.read_u8(addr.checked_add(1 + offset as u32)?)?);
}
Some(bytes)
}
pub(super) fn ppc_i16_result(value: i16) -> u32 {
i32::from(value) as u32
}
pub(crate) fn ppc_run_result_cycles(result: PpcRunResult) -> u64 {
match result {
PpcRunResult::CycleLimit { cycles }
| PpcRunResult::Halted { cycles, .. }
| PpcRunResult::Unimplemented { cycles, .. }
| PpcRunResult::MemoryFault { cycles, .. }
| PpcRunResult::Exception { cycles, .. }
| PpcRunResult::FetchFault { cycles, .. } => cycles,
}
}
fn ppc_run_result_with_cycles(result: PpcRunResult, cycles: u64) -> PpcRunResult {
match result {
PpcRunResult::CycleLimit { .. } => PpcRunResult::CycleLimit { cycles },
PpcRunResult::Halted { pc, .. } => PpcRunResult::Halted { pc, cycles },
PpcRunResult::Unimplemented { pc, error, .. } => {
PpcRunResult::Unimplemented { pc, error, cycles }
}
PpcRunResult::MemoryFault {
pc,
addr,
was_write,
..
} => PpcRunResult::MemoryFault {
pc,
addr,
was_write,
cycles,
},
PpcRunResult::Exception { pc, exception, .. } => PpcRunResult::Exception {
pc,
exception,
cycles,
},
PpcRunResult::FetchFault { pc, .. } => PpcRunResult::FetchFault { pc, cycles },
}
}
struct PpcRetiredThreadStorageEdge<'a> {
manager: &'a mut ProcessNativeMemoryManager,
}
impl RetiredThreadStorageEdge for PpcRetiredThreadStorageEdge<'_> {
fn release_classic(&mut self, stack_base: u32) {
self.manager
.dispose_classic_ptr_from_native_import(stack_base);
}
fn release_native(&mut self, stack_base: u32) {
self.manager.dispose_native_ptr(stack_base);
}
}
pub(super) fn ppc_release_retired_thread_storage(
manager: &mut ProcessNativeMemoryManager,
retirement: NativeRetirement,
recycle: bool,
) {
let storage = match retirement {
NativeRetirement::Removed(storage) | NativeRetirement::Switched(storage) => storage,
};
ThreadManager::release_retired_storage(
storage,
recycle,
&mut PpcRetiredThreadStorageEdge { manager },
);
}
pub(super) fn ppc_resolve_callback_target(
memory: &mut PpcSectionMem,
proc_ptr: u32,
default_rtoc: u32,
selector: Option<u32>,
) -> Option<PpcCallbackTarget> {
let procedure = resolve_guest_procedure(
memory,
proc_ptr,
default_rtoc,
selector,
GuestIsa::PowerPc,
GuestIsa::PowerPc,
)?;
(procedure.isa == GuestIsa::PowerPc).then_some(PpcCallbackTarget {
entry: procedure.entry,
rtoc: procedure.rtoc,
proc_info: procedure.proc_info,
routine_flags: procedure.routine_flags,
})
}
fn import_data_address_for(library_name: &str, symbol_name: &str) -> Option<u32> {
match (library_name, symbol_name) {
("StdCLib", "_IntEnv") => Some(PPC_IMPORT_DATA_BASE),
("StdCLib", "__C_phase") => Some(PPC_IMPORT_DATA_BASE + 0x400),
("StdCLib", "__target_for_exit") => Some(PPC_IMPORT_DATA_BASE + 0x404),
("StdCLib", "_exit_status") => Some(PPC_IMPORT_DATA_BASE + 0x408),
("StdCLib", "_iob") => Some(PPC_STDIO_IOB_ADDR),
("StdCLib", "__p_CType") => Some(PPC_IMPORT_CTYPE_POINTER),
("StdCLib", "_DBL_EPSILON") => Some(PPC_IMPORT_STD_DBL_EPSILON),
("StdCLib", "_DBL_MAX") => Some(PPC_IMPORT_STD_DBL_MAX),
("StdCLib", "_DBL_MIN") => Some(PPC_IMPORT_STD_DBL_MIN),
("StdCLib", "_FLT_EPSILON") => Some(PPC_IMPORT_STD_FLT_EPSILON),
("StdCLib", "_FLT_MAX") => Some(PPC_IMPORT_STD_FLT_MAX),
("StdCLib", "_FLT_MIN") => Some(PPC_IMPORT_STD_FLT_MIN),
("StdCLib", "errno") => Some(PPC_IMPORT_STD_ERRNO),
("StdCLib", "MacOSErr") => Some(PPC_IMPORT_STD_MAC_OS_ERR),
("MathLib", "pi") => Some(PPC_IMPORT_MATH_PI),
("MathLib", "_FE_DFL_ENV") => Some(PPC_IMPORT_MATH_FE_DFL_ENV),
_ => None,
}
}
fn ppc_seed_import_data(memory: &mut PpcSectionMem) {
let _ = memory.write_u32_be(PPC_IMPORT_CTYPE_POINTER, PPC_IMPORT_CTYPE_TABLE);
let _ = memory.write_u64_be(PPC_IMPORT_MATH_PI, std::f64::consts::PI.to_bits());
let _ = memory.write_u32_be(PPC_IMPORT_MATH_FE_DFL_ENV, 0);
let _ = memory.write_u64_be(PPC_IMPORT_STD_DBL_EPSILON, f64::EPSILON.to_bits());
let _ = memory.write_u64_be(PPC_IMPORT_STD_DBL_MAX, f64::MAX.to_bits());
let _ = memory.write_u64_be(PPC_IMPORT_STD_DBL_MIN, f64::MIN_POSITIVE.to_bits());
let _ = memory.write_u32_be(PPC_IMPORT_STD_FLT_EPSILON, f32::EPSILON.to_bits());
let _ = memory.write_u32_be(PPC_IMPORT_STD_FLT_MAX, f32::MAX.to_bits());
let _ = memory.write_u32_be(PPC_IMPORT_STD_FLT_MIN, f32::MIN_POSITIVE.to_bits());
let _ = memory.write_u32_be(PPC_IMPORT_STD_ERRNO, 0);
let _ = memory.write_u16_be(PPC_IMPORT_STD_MAC_OS_ERR, 0);
let _ = memory.write_bytes(
PPC_STDIO_IOB_ADDR,
&vec![0; (3 * PPC_STDIO_FILE_SIZE) as usize],
);
for byte in 0u16..=255 {
let _ = memory.write_u8(
PPC_IMPORT_CTYPE_TABLE + u32::from(byte),
ppc_ctype_entry(byte as u8),
);
}
}
fn import_tvector_bytes(count: usize) -> Vec<u8> {
let mut bytes = Vec::with_capacity(count * 8);
for index in 0..count {
let trap_pc = PPC_IMPORT_TRAP_BASE + (index as u32) * 4;
bytes.extend_from_slice(&trap_pc.to_be_bytes());
bytes.extend_from_slice(&0u32.to_be_bytes());
}
bytes
}
fn import_trap_bytes(count: usize) -> Vec<u8> {
let mut bytes = Vec::with_capacity(count * 4);
for _ in 0..count {
bytes.extend_from_slice(&BLR.to_be_bytes());
}
bytes
}
fn ppc_application_init_return_trampoline(main_entry: u32, main_rtoc: u32) -> Vec<u8> {
let words = [
0x2c03_0000, 0x4082_0020, 0x3c40_0000 | (main_rtoc >> 16),
0x6042_0000 | (main_rtoc & 0xffff),
0x3d80_0000 | (main_entry >> 16),
0x618c_0000 | (main_entry & 0xffff),
0x7d89_03a6, 0x4e80_0420, 0x3980_0000, 0x7d89_03a6, 0x4e80_0420, ];
words.into_iter().flat_map(u32::to_be_bytes).collect()
}
fn ppc_initializers_trampoline(
initializers: &[(u32, u32)],
main_entry: u32,
main_rtoc: u32,
) -> Vec<u8> {
let mut words = Vec::new();
for (descriptor, init_block) in initializers {
words.extend_from_slice(&[
0x3c60_0000 | (init_block >> 16),
0x6063_0000 | (init_block & 0xffff),
0x3d80_0000 | (descriptor >> 16),
0x618c_0000 | (descriptor & 0xffff),
0x800c_0000, 0x804c_0004, 0x7c09_03a6, 0x4e80_0421, 0x2c03_0000, 0x4182_0010, 0x3980_0000, 0x7d89_03a6, 0x4e80_0420, ]);
}
words.extend_from_slice(&[
0x3c40_0000 | (main_rtoc >> 16),
0x6042_0000 | (main_rtoc & 0xffff),
0x3d80_0000 | (main_entry >> 16),
0x618c_0000 | (main_entry & 0xffff),
0x7d89_03a6, 0x4e80_0420, ]);
words.into_iter().flat_map(u32::to_be_bytes).collect()
}
fn alignment_bytes(power: u8) -> Result<u32, PpcLoadError> {
if power >= 31 {
return Err(PpcLoadError::AddressOverflow);
}
Ok(1u32 << power)
}
pub(crate) fn align_up(value: u32, align: u32) -> Result<u32, PpcLoadError> {
if align <= 1 {
return Ok(value);
}
let mask = align - 1;
value
.checked_add(mask)
.map(|v| v & !mask)
.ok_or(PpcLoadError::AddressOverflow)
}
fn normalize_stack_size(requested: u32) -> Result<u32, PpcLoadError> {
let requested = if requested == 0 {
PPC_DEFAULT_STACK_SIZE
} else {
requested
};
let requested = requested.max(PPC_INITIAL_STACK_FRAME_SIZE);
let aligned =
align_up(requested, 16).map_err(|_| PpcLoadError::StackSizeOutOfRange { requested })?;
if aligned > PPC_MAX_STACK_SIZE {
return Err(PpcLoadError::StackSizeOutOfRange { requested });
}
Ok(aligned)
}
fn read_u32(data: &[u8], offset: usize) -> Option<u32> {
Some(u32::from_be_bytes(
data.get(offset..offset + 4)?.try_into().ok()?,
))
}
#[cfg(test)]
pub(crate) mod tests;