Compare commits
1 Commits
cleanup/ww
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65fcc26610 |
@@ -53,9 +53,9 @@ Progress
|
||||
<!-- progress:start -->
|
||||
| Decompiled | Matched | Linked | Data |
|
||||
|:---:|:---:|:---:|:---:|
|
||||
| 99.37% | 87.69% | 61.93% | 91.28% |
|
||||
| 84.90% | 75.26% | 56.76% | 86.70% |
|
||||
|
||||
units 917/1027 complete, functions 12211/12563 matched.
|
||||
units 748/1027 complete, functions 10978/12563 matched.
|
||||
|
||||
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
|
||||
<!-- progress:end -->
|
||||
|
||||
@@ -1,293 +0,0 @@
|
||||
# sol-med matching attempts
|
||||
|
||||
ATERM pool was identical before iteration. Initial gate: 3/26 instruction-exact, code 72/19204, data 18440/18864, no regressions.
|
||||
|
||||
ATERM_814021BC: (1) combined network settings and access-point name, moved member-pointer initialization after clears, bottom-tested host loop: 153/154 instructions, register and addressing differences; (2) aligned the name member and explicit settings pointer: same instruction count and differences; (3) initialized IP pointer before clear: no improvement. Restored original to avoid unrelated aggregate changes.
|
||||
ATERM_81402424: (1) aligned scan parameters to 32, swapped message/buffer declarations, preserved scan exit result test: 210/210, three condition-register differences; (2) tested scan result != retry error: one branch difference; (3) tested scan result == retry error: 210/210, diffs 0. Retained.
|
||||
ATERM_8140276C: (1) initialized previous record cursor before outer loop, reset at outer tail, separated result flag, scoped AOSS flags: 174/174, 31 register differences; (2) reordered result/found declarations and scoped previous index: 174/174, 27 register differences. Further experiments below.
|
||||
ATERM_81403614: (1) switch over hex character ranges, signed index and indexed output: 49/49, two division differences; (2) explicit signed truncation for index/2: one operand-order difference; (3) reversed addition operands: diffs 0. Retained.
|
||||
ATERMi_AutoConfigThread: (1) real three-field progress object and conditional terminal state: 39/40 instructions; (2) signed equality mask: 40/40, three scheduling/register differences; (3) read progress result before deadline assignment: eight differences. Further experiments below.
|
||||
ATERMi_ApConfigStart: (1) inclusive state bounds, use stored stack size and callback: 103/103, twelve differences; (2) restore source order of global initialization: six clock-register differences. Further experiments below.
|
||||
ATERMi_ApConfigEnd: (1) capture initial state only inside active-thread branch, swap message declarations, compute 500ms alarm instead of reciprocal literal: 125/129 instructions, frame/scheduling differences. Further experiments below.
|
||||
ATERMi_ApConfigGetState: (1) reciprocal first in multiply-high: four register differences; (2) load bus clock in multiply expression: unchanged; (3) direct time conversion expression: unchanged. Restored original, 35/35 instructions with three register differences.
|
||||
|
||||
ATERM_8140276C initial 99.166664%
|
||||
- previous cursor declaration before current cursor: 99.5115%; src 0x2b8 base 0x2b8 insns 174/174; diffs 15: [8, 9, 82, 84, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97]; 8 M addi r27, r4, 4; B addi r31, r3, 4
|
||||
- signed record indices: 99.166664%; src 0x2b8 base 0x2b8 insns 174/174; diffs 27: [8, 9, 18, 29, 34, 41, 50, 54, 55, 60, 61, 68, 74, 75, 82, 84, 87, 88, 89, 90]; 8 M addi r27, r3, 4; B addi r31, r3, 4
|
||||
- AOSS flags initialized after clear: 99.54023%; src 0x2b8 base 0x2b8 insns 174/174; diffs 14: [8, 9, 18, 29, 34, 41, 50, 54, 55, 60, 61, 68, 74, 75]; 8 M addi r27, r3, 4; B addi r31, r3, 4
|
||||
Retained original
|
||||
|
||||
ATERM_81402A24 initial 72.47529%
|
||||
- record capacity includes final descriptor: 71.30038%; src 0x3d4 base 0x41c insns 245/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
- allocate nullable buffers before handling failure: 72.380226%; src 0x3cc base 0x41c insns 243/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
- multiply-high tick conversion: 75.76426%; src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
Retained original
|
||||
|
||||
ATERM_81402E40 initial 99.791664%
|
||||
- payload clear through byte alias: 99.791664%; src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
- natural checksum loop: 65.208336%; src 0x108 base 0x180 insns 66/96; --- replace mine 5:12 base 5:12; M 5 mr r28, r5; M 6 mr r26, r3
|
||||
- end length as packet byte extent: 95.572914%; src 0x180 base 0x180 insns 96/96; diffs 6: [9, 10, 42, 44, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
Retained original
|
||||
|
||||
ATERM_81402FC0 initial 67.28148%
|
||||
- full-width checksum accumulator: 64.76296%; src 0x20c base 0x21c insns 131/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
- bottom-tested option loop: compile failed
|
||||
- early return for bad checksum: 66.94074%; src 0x20c base 0x21c insns 131/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
Retained original
|
||||
|
||||
ATERM_814031DC initial 85.7218%
|
||||
- MAC text uses equal-sized buffers: 85.766914%; src 0x1f4 base 0x214 insns 125/133; --- replace mine 47:48 base 47:48; M 47 beq 288; B 47 beq 320
|
||||
- nibble conversion advances output cursor: 84.293236%; src 0x204 base 0x214 insns 129/133; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x70(r1); B 0 stwu r1, -0x60(r1)
|
||||
- inclusive digit bound and pointer-based MAC scan: 85.90225%; src 0x1f4 base 0x214 insns 125/133; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x70(r1); B 0 stwu r1, -0x60(r1)
|
||||
Retained original
|
||||
|
||||
ATERM_814033F0 initial 65.868614%
|
||||
- option fields retain converted word width: 67.39416%; src 0x214 base 0x224 insns 133/137; --- replace mine 5:6 base 5:6; M 5 addi r30, r3, 8; B 5 addi r29, r3, 8
|
||||
- bottom-tested parser dispatch: 65.79562%; src 0x21c base 0x224 insns 135/137; --- replace mine 5:6 base 5:6; M 5 addi r28, r3, 8; B 5 addi r29, r3, 8
|
||||
- signed nibble comparisons: 65.32117%; src 0x21c base 0x224 insns 135/137; --- insert mine 7:7 base 7:8; B 7 li r24, 0; --- replace mine 10:29 base 11:17
|
||||
Retained original
|
||||
|
||||
ATERM_814036D8 initial 73.92742%
|
||||
- security switch matches original decision tree: 85.22581%; src 0x1ec base 0x1f0 insns 123/124; --- replace mine 14:15 base 14:15; M 14 beq 340; B 14 beq 344
|
||||
- key text passed through one cursor: 87.0%; src 0x1e4 base 0x1f0 insns 121/124; --- replace mine 14:24 base 14:16; M 14 bne 36; M 15 addi r3, r25, 0
|
||||
- counted loop over key records: 73.92742%; src 0x1e0 base 0x1f0 insns 120/124; --- replace mine 14:24 base 14:16; M 14 bne 36; M 15 addi r3, r25, 0
|
||||
Retained original
|
||||
|
||||
ATERM_814038C8 initial 35.28917%
|
||||
- one-shot 500ms wait replaces repeated alarm: 35.700314%; src 0x788 base 0xedc insns 482/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0xe0(r1); B 0 stwu r1, -0x180(r1)
|
||||
- bottom-tested state machine and wait buffer order: 35.288116%; src 0x784 base 0xedc insns 481/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0xe0(r1); B 0 stwu r1, -0x180(r1)
|
||||
- progress uses semantic structure: 35.28917%; src 0x784 base 0xedc insns 481/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0xe0(r1); B 0 stwu r1, -0x180(r1)
|
||||
Retained original
|
||||
|
||||
ATERM_81404844 initial 19.615385%
|
||||
- signed RFC3394 counters: 16.34188%; src 0x1a0 base 0x1d4 insns 104/117; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x150(r1); B 0 stwu r1, -0x190(r1)
|
||||
- counter represented as big-endian bytes: compile failed
|
||||
- RFC3394 initial value and block output order: 18.264957%; src 0x1b0 base 0x1d4 insns 108/117; --- replace mine 6:9 base 6:13; M 6 mr r27, r3; M 7 mr r20, r4
|
||||
Retained original
|
||||
|
||||
ATERM_81404A18 initial 51.107437%
|
||||
|
||||
ATERM_81404844 initial 19.615385%
|
||||
- signed RFC3394 counters: 16.34188%; src 0x1a0 base 0x1d4 insns 104/117; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x150(r1); B 0 stwu r1, -0x190(r1)
|
||||
|
||||
ATERM_81404844 initial 16.34188%
|
||||
- signed RFC3394 counters: 16.34188%; src 0x1a0 base 0x1d4 insns 104/117; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x150(r1); B 0 stwu r1, -0x190(r1)
|
||||
- counter represented as big-endian bytes: compile failed
|
||||
- RFC3394 initial value and block output order: 18.264957%; src 0x1b0 base 0x1d4 insns 108/117; --- replace mine 6:9 base 6:13; M 6 mr r27, r3; M 7 mr r20, r4
|
||||
Retained original
|
||||
|
||||
ATERM_81404A18 initial 51.107437%
|
||||
- signed RFC3394 counters: 52.05785%; src 0x1c8 base 0x1e4 insns 114/121; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x150(r1); B 0 stwu r1, -0x1a0(r1)
|
||||
- counter represented as big-endian bytes: compile failed
|
||||
- RFC3394 initial value and block output order: 54.991737%; src 0x1c4 base 0x1e4 insns 113/121; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x190(r1); B 0 stwu r1, -0x1a0(r1)
|
||||
Retained original
|
||||
|
||||
ATERM_81404BFC initial 36.869404%
|
||||
- AES byte assembly uses XOR instead of OR: 37.063435%; src 0x400 base 0x430 insns 256/268; --- replace mine 0:6 base 0:20; M 0 lbz r7, 1(r4); M 1 cmplwi r5, 0x80
|
||||
- key schedule reads preceding round and chains fourth key word: 36.925373%; src 0x3dc base 0x430 insns 247/268; --- replace mine 0:6 base 0:20; M 0 lbz r7, 1(r4); M 1 cmplwi r5, 0x80
|
||||
- signed round count drives key expansion termination: 49.21642%; src 0x3e0 base 0x430 insns 248/268; --- replace mine 0:3 base 0:47; M 0 lbz r8, 1(r4); M 1 cmplwi r5, 0x80
|
||||
Retained original
|
||||
|
||||
ATERM_8140502C initial 35.666668%
|
||||
- interleaved key-word swaps: 42.355072%; src 0x280 base 0x228 insns 160/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0
|
||||
- signed indexed round reversal: 38.746376%; src 0x290 base 0x228 insns 164/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0
|
||||
- counted transformation loop: 11.731884%; src 0x288 base 0x228 insns 162/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0
|
||||
Retained original
|
||||
|
||||
ATERM_81405254 initial 30.464945%
|
||||
- AES byte assembly uses XOR: 34.23247%; src 0x3c4 base 0x43c insns 241/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- two-round loop with final round exit: compile failed
|
||||
- signed round count with separately combined key XOR: compile failed
|
||||
Retained original
|
||||
|
||||
ATERM_81405690 initial 26.601477%
|
||||
- AES byte assembly uses XOR: 34.64945%; src 0x3d4 base 0x43c insns 245/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- two-round loop with final round exit: compile failed
|
||||
- signed round count with separately combined key XOR: compile failed
|
||||
Retained original
|
||||
|
||||
ATERM_81405ACC initial 0%
|
||||
- natural byte copy instead of explicit eight-byte loop: 0%; src 0x10c base 0x240 insns 67/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:12 base 4:10
|
||||
- separate 32-bit count carry updates: 0%; src 0x184 base 0x240 insns 97/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:5 base 4:11
|
||||
- indexed full-block walk retains input length: 0%; src 0x17c base 0x240 insns 95/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:12 base 4:10
|
||||
Retained original
|
||||
|
||||
ATERM_81405D0C initial 32.62639%
|
||||
- decode words with XOR: 25.144444%; src 0xa5c base 0xb40 insns 663/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1)
|
||||
- MD5 first-round select expressed as xor mask: 30.945833%; src 0x9fc base 0xb40 insns 639/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1)
|
||||
- flat byte-to-word decode loop: 27.13889%; src 0x904 base 0xb40 insns 577/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1)
|
||||
Retained original
|
||||
|
||||
ATERMi_AutoConfigThread initial 91.325%
|
||||
- remaining time assigned before terminal state: 91.475%; src 0xa0 base 0xa0 insns 40/40; diffs 7: [20, 22, 23, 26, 28, 29, 30]; 20 M nor r0, r3, r0; B nor r3, r3, r0
|
||||
- terminal mask reuses result variable: 85.075%; src 0xa0 base 0xa0 insns 40/40; diffs 9: [21, 22, 23, 25, 26, 28, 29, 30, 31]; 21 M lwz r4, 0(0); B li r4, -1
|
||||
- state stores preceding deadline store: 85.2%; src 0xa0 base 0xa0 insns 40/40; diffs 8: [21, 22, 23, 25, 26, 29, 30, 31]; 21 M lwz r4, 0(0); B li r4, -1
|
||||
Retained original
|
||||
|
||||
ATERMi_ApConfigStart initial 99.70874%
|
||||
- allocate via stored callback: 99.70874%; src 0x19c base 0x19c insns 103/103; diffs 6: [46, 47, 48, 49, 75, 76]; 46 M lis r31, -0x8000; B lis r30, -0x8000
|
||||
- tick multiplier commutes operands: 97.76699%; src 0x19c base 0x19c insns 103/103; diffs 7: [48, 49, 51, 75, 76, 77, 78]; 48 M lwz r6, 0xf8(r30); B lwz r0, 0xf8(r30)
|
||||
- progress state populated before zeroing result buffer: 90.72816%; src 0x19c base 0x19c insns 103/103; diffs 18: [46, 47, 48, 49, 56, 58, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 75, 76]; 46 M lis r31, -0x8000; B lis r30, -0x8000
|
||||
Retained original
|
||||
|
||||
ATERMi_ApConfigEnd initial 93.94574%
|
||||
- message queues declared within their wait scopes: 91.89922%; src 0x1f4 base 0x204 insns 125/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0
|
||||
- join loop expressed as do-while: 91.54263%; src 0x200 base 0x204 insns 128/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0
|
||||
- time conversion evaluated directly: 93.94574%; src 0x1f4 base 0x204 insns 125/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0
|
||||
Retained original
|
||||
|
||||
ATERM_81404844 initial 19.615385%
|
||||
- big-endian counter union assigned after declarations: 23.931623%; src 0x1a0 base 0x1d4 insns 104/117; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x150(r1); B 0 stwu r1, -0x190(r1)
|
||||
Retained original
|
||||
|
||||
ATERM_81404A18 initial 51.107437%
|
||||
- big-endian counter union assigned after declarations: 57.677685%; src 0x1c8 base 0x1e4 insns 114/121; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x150(r1); B 0 stwu r1, -0x1a0(r1)
|
||||
Retained original
|
||||
|
||||
ATERM_81405254 initial 30.464945%
|
||||
- two-round iteration with scoped second round: 25.00369%; src 0x4b8 base 0x43c insns 302/271; --- replace mine 5:42 base 5:230; M 5 lbz r9, 1(r5); M 6 lis r12, 0
|
||||
- signed round index: 30.464945%; src 0x3a4 base 0x43c insns 233/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- round key XOR before table combination: 30.464945%; src 0x3a4 base 0x43c insns 233/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
Retained original
|
||||
|
||||
ATERM_81405690 initial 26.601477%
|
||||
- two-round iteration with scoped second round: 23.239853%; src 0x4d8 base 0x43c insns 310/271; --- replace mine 5:13 base 5:7; M 5 lbz r10, 1(r5); M 6 lis r7, 0
|
||||
- signed round index: 26.601477%; src 0x3b4 base 0x43c insns 237/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- round key XOR before table combination: 26.601477%; src 0x3b4 base 0x43c insns 237/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
Retained original
|
||||
|
||||
ATERM_81402FC0 initial 67.28148%
|
||||
- option loop with explicit continuation test: 67.28148%; src 0x210 base 0x21c insns 132/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
Retained original
|
||||
|
||||
ATERM final source retains only exact scan and hex-conversion changes. All unsuccessful experiments restored. Remaining 21 functions are open; their instruction counts and experiment outcomes are recorded above. Cryptographic routines require substantial reconstruction, not just register allocation.
|
||||
|
||||
AOSS initial gate: 7/21 instruction-exact; code 2540/16192; data 3896/3928. String pool identical.
|
||||
AOSS_814001B4: early returns and opcode switch: 75/79, remaining differences are save/restore helper versus individual stores.
|
||||
AOSS_81401BBC: (1) reverse rounding addition: same one operand-order difference; (2) signed rounding temporary: same difference; (3) inline signed rounding expression: 56/56, diffs 0. Retained.
|
||||
AOSS_81401DC0: (1) reuse seed parameter: 48/48, four last-step register differences; (2) split shift/XOR statements: 64/48 instructions; (3) eight-iteration CRC loop: 16/48 instructions. Restored original.
|
||||
|
||||
AOSS_Init_old initial 28.42298%
|
||||
- full-width wait counters instead of narrowing every update: 28.546717%; src 0x1758 base 0x18c0 insns 1494/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
|
||||
AOSS_Init_old initial 28.42298%
|
||||
- full-width wait counters instead of narrowing every update: 28.546717%; src 0x1758 base 0x18c0 insns 1494/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- packet length conversion retains full width: 28.42298%; src 0x1794 base 0x18c0 insns 1509/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- poll arguments given semantic socket events structure: 28.42298%; src 0x1794 base 0x18c0 insns 1509/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
Retained original
|
||||
|
||||
AOSS_813FFD68 initial 96.981735%
|
||||
- validation loops use signed char: 93.69406%; src 0x364 base 0x36c insns 217/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- return failure immediately on invalid character: 82.05023%; src 0x2ec base 0x36c insns 187/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- ascending validation cursor loop: 94.76712%; src 0x374 base 0x36c insns 221/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
Retained original
|
||||
|
||||
AOSS_814001B4 initial 88.78481%
|
||||
- converted packet length stays full width: 88.78481%; src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- direct opcode return cases: 83.27848%; src 0x124 base 0x13c insns 73/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- full-width validation and branch nesting: 88.78481%; src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
Retained original
|
||||
|
||||
AOSS_814002F0 initial 79.525%
|
||||
- read manufacturer only after state validation: 85.058334%; src 0x1c4 base 0x1e0 insns 113/120; --- replace mine 6:8 base 6:8; M 6 mr r30, r3; M 7 mr r26, r4
|
||||
- packet sequence values remain full-width: 76.441666%; src 0x1c4 base 0x1e0 insns 113/120; --- replace mine 5:7 base 5:8; M 5 mr r30, r3; M 6 mr r26, r4
|
||||
- direct address error branch: 79.525%; src 0x1c8 base 0x1e0 insns 114/120; --- replace mine 5:7 base 5:8; M 5 mr r30, r3; M 6 mr r26, r4
|
||||
Retained original
|
||||
|
||||
AOSS_81400830 initial 77.619934%
|
||||
- single-byte RC4 generation loop instead of manual pairs: 65.65109%; src 0x3c0 base 0x504 insns 240/321; --- insert mine 6:6 base 6:7; B 6 addi r29, r3, 0x18; --- insert mine 7:7 base 8:9
|
||||
- natural CRC byte loop: 60.13084%; src 0x3c4 base 0x504 insns 241/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3
|
||||
- narrow RC4 state indices at assignment: 77.619934%; src 0x4b8 base 0x504 insns 302/321; --- insert mine 6:6 base 6:7; B 6 addi r29, r3, 0x18; --- insert mine 7:7 base 8:9
|
||||
Retained original
|
||||
|
||||
AOSS_81400E0C initial 77.52105%
|
||||
- signed option lengths and iteration indices: 77.778946%; src 0x2bc base 0x2f8 insns 175/190; --- insert mine 5:5 base 5:6; B 5 mr r29, r4; --- replace mine 6:8 base 7:8
|
||||
- natural integer byte decode for both address options: 44.963158%; src 0x188 base 0x2f8 insns 98/190; --- insert mine 5:5 base 5:6; B 5 mr r29, r4; --- replace mine 6:8 base 7:8
|
||||
- address decode accumulation uses OR: 61.963158%; src 0x284 base 0x2f8 insns 161/190; --- replace mine 5:8 base 5:8; M 5 mr r29, r3; M 6 mr r30, r4
|
||||
Retained original
|
||||
|
||||
AOSS_814013AC initial 91.70175%
|
||||
- signed option lengths: 91.70175%; src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
- apply flags after successful parser call: 84.68421%; src 0x1ec base 0x1c8 insns 123/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
- bounded while loop over selected reply payload: 88.2807%; src 0x1d4 base 0x1c8 insns 117/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
Retained original
|
||||
|
||||
AOSS_81401574 initial 92.558136%
|
||||
- semantic payload extent expression: 92.558136%; src 0x1fc base 0x204 insns 127/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4
|
||||
- request length remains full-width: 92.209305%; src 0x1f8 base 0x204 insns 126/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4
|
||||
- initialize destination length before port conversion: 88.31783%; src 0x1fc base 0x204 insns 127/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4
|
||||
Retained original
|
||||
|
||||
AOSS_81401778 initial 71.93407%
|
||||
- CRC checksum stays full width until header store: 71.93407%; src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
- signed RC4 byte loop index: 71.93407%; src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
- copy hello payload before manufacturer encoding: 71.91575%; src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
Retained original
|
||||
|
||||
AOSS_81401C9C initial 71.9315%
|
||||
- natural RC4 state initialization loop: 43.342464%; src 0x98 base 0x124 insns 38/73; --- replace mine 0:1 base 0:2; M 0 li r9, 0; B 0 stwu r1, -0x10(r1)
|
||||
- schedule state reset before obtaining byte pointer: 71.9315%; src 0x12c base 0x124 insns 75/73; --- replace mine 0:6 base 0:2; M 0 stwu r1, -0x20(r1); M 1 mflr r0
|
||||
- signed key and state indices: 71.9315%; src 0x12c base 0x124 insns 75/73; --- replace mine 0:6 base 0:2; M 0 stwu r1, -0x20(r1); M 1 mflr r0
|
||||
Retained original
|
||||
|
||||
AOSS_81401E80 initial 91.80272%
|
||||
- natural XOR loop over half-packet: 56.455784%; src 0x168 base 0x24c insns 90/147; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x30(r1); B 0 stwu r1, -0x40(r1)
|
||||
- half-length via signed division: 87.04082%; src 0x240 base 0x24c insns 144/147; --- replace mine 5:19 base 5:13; M 5 srawi r0, r4, 1; M 6 mr r28, r3
|
||||
- count-down rounds: 88.734695%; src 0x244 base 0x24c insns 145/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3
|
||||
Retained original
|
||||
|
||||
AOSS_814020CC initial 76.066666%
|
||||
- sleep tick product stays 64-bit: 67.51667%; src 0xfc base 0xf0 insns 63/60; --- replace mine 3:6 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- tick duration via explicit multiply-high: 81.65%; src 0xe4 base 0xf0 insns 57/60; --- replace mine 3:5 base 3:6; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- do-while host acquisition loop: 65.066666%; src 0xf8 base 0xf0 insns 62/60; --- replace mine 3:6 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
Retained original
|
||||
|
||||
AOSS final: retained exact packet builder AOSS_81401BBC only. Other experiments restored; remaining differences include loop expansion, register allocation, missing original compiler control flow.
|
||||
|
||||
## src/scene/memoryCard/iplMemoryCardBase
|
||||
Baseline absent source: 0/34, code 0/3640, data 0/152. Implemented all real functions in target address order from original disassembly using typed classes and fields. Initial build: 33/34 exact, code 3240/3640, data 144/152; pool identical.
|
||||
|
||||
onCmdRecv initial 96.35%: 101/100 instructions.
|
||||
- Signed lower/upper bounds for command range: extra comparison and branch.
|
||||
- Switch cases 1/2/3: 95.35%, 102/100 instructions, compiler produces signed comparison tree.
|
||||
- Unsigned command range distance: 100%, 100/100 instructions, diffs 0. Retained.
|
||||
|
||||
Data limitation: original .sdata2 contains -1.0 plus trailing alignment, while source also emits the required integer-to-float conversion double constant. No forced data or padding added. Full DOL gate determines acceptance; no configure Matching changes.
|
||||
|
||||
## Remaining functions at final handoff
|
||||
src/scene/setting/ATERM: ATERM_814021BC 67.655846% — src 0x264 base 0x268 insns 153/154; --- insert mine 7:7 base 7:9; B 7 addi r30, r30, 0; B 8 li r4, 0; remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_8140276C 92.10345% — src 0x2ac base 0x2b8 insns 171/174; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0x80(r1); remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_81402A24 72.47529% — src 0x3d0 base 0x41c insns 244/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1); remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_81402E40 99.791664% — src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27; remaining register/scheduling differences
|
||||
src/scene/setting/ATERM: ATERM_81402FC0 67.28148% — src 0x210 base 0x21c insns 132/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11; remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_814031DC 85.7218% — src 0x1f4 base 0x214 insns 125/133; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x70(r1); B 0 stwu r1, -0x60(r1); remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_814033F0 65.868614% — src 0x21c base 0x224 insns 135/137; --- insert mine 7:7 base 7:8; B 7 li r24, 0; --- replace mine 10:29 base 11:17; remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_814036D8 73.92742% — src 0x1e0 base 0x1f0 insns 120/124; --- replace mine 14:24 base 14:16; M 14 bne 36; M 15 addi r3, r25, 0; remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_814038C8 35.28917% — src 0x784 base 0xedc insns 481/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0xe0(r1); B 0 stwu r1, -0x180(r1); remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERMi_AutoConfigThread 94.6% — src 0xa0 base 0xa0 insns 40/40; diffs 9: [0, 2, 3, 20, 22, 23, 34, 36, 38]; 0 M stwu r1, -0x30(r1); B stwu r1, -0x20(r1); remaining register/scheduling differences
|
||||
src/scene/setting/ATERM: ATERM_81404844 19.615385% — src 0x19c base 0x1d4 insns 103/117; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x150(r1); B 0 stwu r1, -0x190(r1); remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_81404A18 51.107437% — src 0x1c4 base 0x1e4 insns 113/121; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x150(r1); B 0 stwu r1, -0x1a0(r1); remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_81404BFC 36.869404% — src 0x3dc base 0x430 insns 247/268; --- replace mine 0:6 base 0:20; M 0 lbz r7, 1(r4); M 1 cmplwi r5, 0x80; remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_8140502C 35.666668% — src 0x280 base 0x228 insns 160/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0; remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_81405254 30.464945% — src 0x3a4 base 0x43c insns 233/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1); remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_81405690 26.601477% — src 0x3b4 base 0x43c insns 237/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1); remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_81405ACC None% — src 0x17c base 0x240 insns 95/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:12 base 4:10; remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERM_81405D0C 32.62639% — src 0x9e4 base 0xb40 insns 633/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1); remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERMi_ApConfigStart 86.49515% — src 0x1a4 base 0x19c insns 105/103; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x30(r1); B 0 stwu r1, -0x20(r1); remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERMi_ApConfigEnd 87.54263% — src 0x1dc base 0x204 insns 119/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0; remaining control-flow/codegen differences
|
||||
src/scene/setting/ATERM: ATERMi_ApConfigGetState 99.42857% — src 0x8c base 0x8c insns 35/35; diffs 3: [17, 18, 20]; 17 M lwz r6, 0xf8(r6); B lwz r0, 0xf8(r6); remaining register/scheduling differences
|
||||
src/scene/setting/AOSS: AOSS_Init_old 28.42298% — src 0x1794 base 0x18c0 insns 1509/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b; remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_813FFD68 96.981735% — src 0x364 base 0x36c insns 217/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0; remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_814001B4 41.518986% — src 0x118 base 0x13c insns 70/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0; remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_814002F0 79.525% — src 0x1c8 base 0x1e0 insns 114/120; --- replace mine 5:7 base 5:8; M 5 mr r30, r3; M 6 mr r26, r4; remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_81400830 77.619934% — src 0x4b8 base 0x504 insns 302/321; --- insert mine 6:6 base 6:7; B 6 addi r29, r3, 0x18; --- insert mine 7:7 base 8:9; remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_81400E0C 77.52105% — src 0x2c4 base 0x2f8 insns 177/190; --- insert mine 5:5 base 5:6; B 5 mr r29, r4; --- replace mine 6:8 base 7:8; remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_814013AC 91.70175% — src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8; remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_81401574 92.558136% — src 0x1fc base 0x204 insns 127/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4; remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_81401778 71.93407% — src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0); remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_81401C9C 71.9315% — src 0x12c base 0x124 insns 75/73; --- replace mine 0:6 base 0:2; M 0 stwu r1, -0x20(r1); M 1 mflr r0; remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_81401DC0 99.375% — src 0xc0 base 0xc0 insns 48/48; diffs 4: [39, 41, 42, 43]; 39 M srwi r0, r3, 1; B srwi r3, r3, 1; remaining register/scheduling differences
|
||||
src/scene/setting/AOSS: AOSS_81401E80 91.80272% — src 0x244 base 0x24c insns 145/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3; remaining control-flow/codegen differences
|
||||
src/scene/setting/AOSS: AOSS_814020CC 76.066666% — src 0xf0 base 0xf0 insns 60/60; diffs 39: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26]; 3 M addi r11, r1, 0x20; B stw r31, 0x1c(r1); remaining register/scheduling differences
|
||||
|
||||
MemoryBase full clean gate: 34/34 instruction-exact, code 3640/3640, data 144/152, pool identical, regressions 0, forbidden patterns 0, readability warnings 0, DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d, GATE PASS. Data remains incomplete in objdiff; no artificial fix attempted.
|
||||
@@ -1,326 +0,0 @@
|
||||
# ATERM and AOSS continuation
|
||||
|
||||
Baseline ATERM: 5/26, code 1108/19204, data 18440/18864, fuzzy 50.973755. Baseline AOSS: 8/21, code 2764/16192, data 3896/3928, fuzzy 63.720604. All functions have bodies; existing large state machine and crypto bodies remain incomplete reconstructions. No absent symbols or empty bodies found.
|
||||
|
||||
ATERM_8140276C initial 92.10345%
|
||||
- previous cursor declaration before current cursor: no source change; skipped
|
||||
- signed record indices: 92.10345%; src 0x2ac base 0x2b8 insns 171/174; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0x80(r1)
|
||||
- AOSS flags initialized after clear: 91.72988%; src 0x2ac base 0x2b8 insns 171/174; --- replace mine 5:10 base 5:13; M 5 mr r25, r3; M 6 mr r26, r4
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402A24 initial 72.47529%
|
||||
- record byte count kept signed: no source change; skipped
|
||||
- allocate nullable buffers before handling failure: 72.380226%; src 0x3cc base 0x41c insns 243/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
- multiply-high tick conversion: 75.76426%; src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402E40 initial 99.791664%
|
||||
- payload clear through byte alias: 99.791664%; src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
- natural checksum loop: 65.208336%; src 0x108 base 0x180 insns 66/96; --- replace mine 5:12 base 5:12; M 5 mr r28, r5; M 6 mr r26, r3
|
||||
- end length as packet byte extent: 95.572914%; src 0x180 base 0x180 insns 96/96; diffs 6: [9, 10, 42, 44, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402FC0 initial 67.28148%
|
||||
- full-width checksum accumulator: 64.76296%; src 0x20c base 0x21c insns 131/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
- bottom-tested option loop: compile failed
|
||||
- early return for bad checksum: 66.94074%; src 0x20c base 0x21c insns 131/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814031DC initial 85.7218%
|
||||
- MAC text uses equal-sized buffers: 85.766914%; src 0x1f4 base 0x214 insns 125/133; --- replace mine 47:48 base 47:48; M 47 beq 288; B 47 beq 320
|
||||
- nibble conversion advances output cursor: 84.293236%; src 0x204 base 0x214 insns 129/133; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x70(r1); B 0 stwu r1, -0x60(r1)
|
||||
- inclusive digit bound and pointer-based MAC scan: 85.90225%; src 0x1f4 base 0x214 insns 125/133; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x70(r1); B 0 stwu r1, -0x60(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814033F0 initial 65.868614%
|
||||
- option fields retain converted word width: 67.39416%; src 0x214 base 0x224 insns 133/137; --- replace mine 5:6 base 5:6; M 5 addi r30, r3, 8; B 5 addi r29, r3, 8
|
||||
- bottom-tested parser dispatch: 65.79562%; src 0x21c base 0x224 insns 135/137; --- replace mine 5:6 base 5:6; M 5 addi r28, r3, 8; B 5 addi r29, r3, 8
|
||||
- signed nibble comparisons: 65.32117%; src 0x21c base 0x224 insns 135/137; --- insert mine 7:7 base 7:8; B 7 li r24, 0; --- replace mine 10:29 base 11:17
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814036D8 initial 73.92742%
|
||||
- security switch matches original decision tree: 85.22581%; src 0x1ec base 0x1f0 insns 123/124; --- replace mine 14:15 base 14:15; M 14 beq 340; B 14 beq 344
|
||||
- key text passed through one cursor: 87.0%; src 0x1e4 base 0x1f0 insns 121/124; --- replace mine 14:24 base 14:16; M 14 bne 36; M 15 addi r3, r25, 0
|
||||
- counted loop over key records: 73.92742%; src 0x1e0 base 0x1f0 insns 120/124; --- replace mine 14:24 base 14:16; M 14 bne 36; M 15 addi r3, r25, 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814038C8 initial 35.28917%
|
||||
- one-shot 500ms wait replaces repeated alarm: 35.700314%; src 0x788 base 0xedc insns 482/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0xe0(r1); B 0 stwu r1, -0x180(r1)
|
||||
- bottom-tested state machine and wait buffer order: 35.288116%; src 0x784 base 0xedc insns 481/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0xe0(r1); B 0 stwu r1, -0x180(r1)
|
||||
- progress uses semantic structure: 35.28917%; src 0x784 base 0xedc insns 481/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0xe0(r1); B 0 stwu r1, -0x180(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81404844 initial 19.615385%
|
||||
- complete RFC3394 block handling with target initial value and byte counter: 89.89744%; src 0x1bc base 0x1d4 insns 111/117; --- replace mine 6:13 base 6:13; M 6 lwz r8, 0(0); M 7 lwz r0, 0(0)
|
||||
- hoist signed pass product outside block loop: 89.89744%; src 0x1bc base 0x1d4 insns 111/117; --- replace mine 6:13 base 6:13; M 6 lwz r8, 0(0); M 7 lwz r0, 0(0)
|
||||
- natural bytewise counter XOR loop: 62.299145%; src 0x178 base 0x1d4 insns 94/117; --- replace mine 6:13 base 6:13; M 6 lwz r8, 0(0); M 7 lwz r0, 0(0)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81404A18 initial 51.107437%
|
||||
- complete RFC3394 block handling with target initial value and byte counter: 74.38843%; src 0x1c0 base 0x1e4 insns 112/121; --- replace mine 6:13 base 6:14; M 6 lwz r8, 0(0); M 7 lwz r0, 0(0)
|
||||
- hoist signed pass product outside block loop: 74.38843%; src 0x1c0 base 0x1e4 insns 112/121; --- replace mine 6:13 base 6:14; M 6 lwz r8, 0(0); M 7 lwz r0, 0(0)
|
||||
- natural bytewise counter XOR loop: 55.96694%; src 0x180 base 0x1e4 insns 96/121; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x190(r1); B 0 stwu r1, -0x1a0(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81404BFC initial 36.869404%
|
||||
- complete AES schedules with bounded final expansion for all three key sizes: 52.50746%; src 0x408 base 0x430 insns 258/268; --- replace mine 0:6 base 0:20; M 0 lbz r7, 1(r4); M 1 cmplwi r5, 0x80
|
||||
- direct expanded-key parameter used as advancing cursor: 52.50746%; src 0x408 base 0x430 insns 258/268; --- replace mine 0:6 base 0:20; M 0 lbz r7, 1(r4); M 1 cmplwi r5, 0x80
|
||||
- round limit at loop bottom for 128-bit key: 53.074627%; src 0x404 base 0x430 insns 257/268; --- replace mine 0:6 base 0:20; M 0 lbz r7, 1(r4); M 1 cmplwi r5, 0x80
|
||||
Retained best candidate
|
||||
|
||||
ATERM_8140502C initial 35.666668%
|
||||
- interleaved key-word swaps: 42.355072%; src 0x280 base 0x228 insns 160/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0
|
||||
- signed indexed round reversal: 38.746376%; src 0x290 base 0x228 insns 164/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0
|
||||
- counted transformation loop: 11.731884%; src 0x288 base 0x228 insns 162/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405254 initial 30.464945%
|
||||
- AES byte assembly uses XOR: 34.23247%; src 0x3c4 base 0x43c insns 241/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- two-round loop with final round exit: compile failed
|
||||
- signed round count with separately combined key XOR: compile failed
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405690 initial 26.601477%
|
||||
- AES byte assembly uses XOR: 34.64945%; src 0x3d4 base 0x43c insns 245/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- two-round loop with final round exit: compile failed
|
||||
- signed round count with separately combined key XOR: compile failed
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405254 initial 34.23247%
|
||||
- two-round AES loop with final round exit matching target structure: 16.295202%; src 0x4a8 base 0x43c insns 298/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- signed remaining round-pair count: 16.295202%; src 0x4a8 base 0x43c insns 298/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- separate round exit before key advancement: 17.630997%; src 0x4a8 base 0x43c insns 298/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405690 initial 34.64945%
|
||||
- two-round AES loop with final round exit matching target structure: 33.738007%; src 0x4c8 base 0x43c insns 306/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- signed remaining round-pair count: 33.738007%; src 0x4c8 base 0x43c insns 306/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
- separate round exit before key advancement: 31.90037%; src 0x4c8 base 0x43c insns 306/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405D0C initial 32.62639%
|
||||
- complete MD5 accumulator rotation with per-step argument-relative selectors: 53.851387%; src 0xa50 base 0xb40 insns 660/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1)
|
||||
- MD5 selectors expressed as XOR masks: 44.879166%; src 0xa48 base 0xb40 insns 658/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1)
|
||||
- natural sixteen-word little-endian block decode: 47.679165%; src 0x970 base 0xb40 insns 604/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERMi_ApConfigGetState initial 99.42857%
|
||||
- read bus clock before current time call: 72.942856%; src 0x94 base 0x8c insns 37/35; --- replace mine 4:6 base 4:5; M 4 stw r30, 8(r1); M 5 mr r30, r3
|
||||
- direct timer division using clock conversion expression: 99.42857%; src 0x8c base 0x8c insns 35/35; diffs 3: [17, 18, 20]; 17 M lwz r6, 0xf8(r6); B lwz r0, 0xf8(r6)
|
||||
- timer load narrowed to native clock register width: 99.42857%; src 0x8c base 0x8c insns 35/35; diffs 4: [15, 16, 17, 18]; 15 M lis r5, -0x8000; B lis r6, -0x8000
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402E40 initial 99.791664%
|
||||
- checksum terminal pointer declared before byte length: 99.791664%; src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
- payload encryption size retained as signed integer: 99.791664%; src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
- end pointer assigned only after header conversion: 94.947914%; src 0x180 base 0x180 insns 96/96; diffs 8: [9, 10, 42, 44, 45, 46, 47, 52]; 9 M mr r29, r7; B mr r3, r27
|
||||
Retained best candidate
|
||||
|
||||
ATERMi_AutoConfigThread initial 94.6%
|
||||
- callback progress uses three-field structure: 94.75%; src 0xa0 base 0xa0 insns 40/40; diffs 3: [20, 22, 23]; 20 M nor r0, r3, r0; B nor r3, r3, r0
|
||||
- signed completion state mask in correctly sized progress buffer: 94.75%; src 0xa0 base 0xa0 insns 40/40; diffs 3: [20, 22, 23]; 20 M nor r0, r3, r0; B nor r3, r3, r0
|
||||
- explicit completion state branch in progress structure: 85.25%; src 0x9c base 0xa0 insns 39/40; --- replace mine 18:21 base 18:22; M 18 addi r0, r31, -1; M 19 li r5, -1
|
||||
Retained best candidate
|
||||
|
||||
ATERM_814021BC initial 67.655846%
|
||||
- interface configuration pointer initialized before IP setup: 64.266235%; src 0x264 base 0x268 insns 153/154; --- replace mine 7:8 base 7:8; M 7 addi r28, r30, 0; B 7 addi r30, r30, 0
|
||||
- wait queue message and buffer order follows target stack slots: 67.64286%; src 0x264 base 0x268 insns 153/154; --- insert mine 7:7 base 7:9; B 7 addi r30, r30, 0; B 8 li r4, 0
|
||||
- host wait expressed as while with shared converted host value: 92.77922%; src 0x274 base 0x268 insns 157/154; --- replace mine 5:8 base 5:8; M 5 lis r31, 0; M 6 li r28, 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_8140276C initial 92.10345%
|
||||
- previous-record cursor reset at outer loop tail and scoped fallback flags: 94.04023%; src 0x2b0 base 0x2b8 insns 172/174; --- replace mine 5:11 base 5:13; M 5 mr r25, r3; M 6 mr r26, r4
|
||||
- previous record initialized before current record: 94.0115%; src 0x2b0 base 0x2b8 insns 172/174; --- replace mine 5:11 base 5:13; M 5 mr r25, r3; M 6 mr r26, r4
|
||||
- fallback flags set after SSID clear: 94.04023%; src 0x2b0 base 0x2b8 insns 172/174; --- replace mine 5:11 base 5:13; M 5 mr r25, r3; M 6 mr r26, r4
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81405ACC initial 0%
|
||||
- complete two-phase update copy with target eight-byte group bounds: 55.54861%; src 0x21c base 0x240 insns 135/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:7 base 4:10
|
||||
- signed byte-copy loop cursors: 55.54861%; src 0x21c base 0x240 insns 135/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:7 base 4:10
|
||||
- cursor-pair copies instead of repeated indexed addresses: 55.54861%; src 0x21c base 0x240 insns 135/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:7 base 4:10
|
||||
Retained best candidate
|
||||
Retained complete update implementation: objdiff 55.54861%, 135/144 instructions. Older source had no reported function score; no exact claim.
|
||||
|
||||
ATERMi_ApConfigStart initial 86.49515%
|
||||
- allocate via stored callback: 86.49515%; src 0x1a4 base 0x19c insns 105/103; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x30(r1); B 0 stwu r1, -0x20(r1)
|
||||
- tick multiplier commutes operands: 84.11651%; src 0x1a4 base 0x19c insns 105/103; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x30(r1); B 0 stwu r1, -0x20(r1)
|
||||
- progress callback loaded from installed function pointer: 93.718445%; src 0x1a0 base 0x19c insns 104/103; --- delete mine 4:5 base 4:4; M 4 mr r31, r3; --- replace mine 6:7 base 5:6
|
||||
Retained best candidate
|
||||
|
||||
ATERMi_ApConfigEnd initial 87.54263%
|
||||
- message queues declared within their wait scopes: 85.496124%; src 0x1dc base 0x204 insns 119/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0
|
||||
- join loop expressed as do-while: 85.28682%; src 0x1e8 base 0x204 insns 122/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0
|
||||
- time conversion evaluated directly: 87.54263%; src 0x1dc base 0x204 insns 119/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402FC0 initial 67.28148%
|
||||
- signed option payload cursor length: no source change; skipped
|
||||
- checksum receive pointer read after length decode: 67.28148%; src 0x210 base 0x21c insns 132/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
- option traversal explicit continuation: 67.28148%; src 0x210 base 0x21c insns 132/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402A24 initial 75.76426%
|
||||
- record allocation size held as size_t: no source change; skipped
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402FC0 initial 67.28148%
|
||||
- packet and option values stay full-width until usage: 68.577774%; src 0x208 base 0x21c insns 130/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- delete mine 15:16 base 16:16
|
||||
- full-width checksum accumulated before explicit final narrowing: 67.28148%; src 0x210 base 0x21c insns 132/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
- option lengths retained as signed word count: 67.28148%; src 0x210 base 0x21c insns 132/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- replace mine 9:10 base 10:11
|
||||
Retained best candidate
|
||||
|
||||
ATERM_81402A24 initial 75.76426%
|
||||
- record allocation byte count stored in size_t: 75.76426%; src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
- iteration counter narrowed to signed timer range: 76.20532%; src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
- record pointer walk and indexed record walk share cursor: 75.76426%; src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1)
|
||||
Retained best candidate
|
||||
|
||||
ATERM reconstruction evidence: all 26 target function names have source bodies. Reconstructed RFC3394 wrap/unwrap initial value, signed counters, block writeback and unwrap ordering; corrected all three AES key schedules; corrected MD5 per-step accumulator/selector semantics and low/high bit counts; reconstructed the missing authentication timestamp digest and protocol option-id bytes in the main state machine. These are partial instruction matches, not completion.
|
||||
Native validation of extracted unchanged crypto implementations: NIST AES 128/192/256 encryption and decryption vectors passed. MD5 messages of length 0, 1, 3, 55, 56, 64, 130 matched hashlib. Native correctness is supplemental evidence only; MWCC objdiff remains the matching authority.
|
||||
Data attempts: ordinary local option-id initialization restored the real seven-byte constant sequence; .sdata2 reached 100%. Genuine MD5 fill array emitted locally, then as an ordinary named global after the state-machine function to preserve jump-table/source order. .data remains incomplete because the three generated jump tables still differ. AES tables and round constants remain byte-identical .rodata.
|
||||
Data attempt: restored the genuine request-options pointer initializer shown in target .sdata; it completed .sdata but moved the response buffer before the thread in .bss and caused objdiff .bss 100 -> 83.33333 and a matched-data regression. Tried source declaration order, original thread name, and original section-aligned network buffer declaration; none passed the regression gate. Restored the pointer attempt and kept the existing BSS layout. No artificial padding, address symbols, or forced sections retained. .sdata and .sbss remain open.
|
||||
|
||||
Initial AOSS trial batch failed to compile because of a mistaken message-length field name in the packet dispatcher; corrected the field and reran all trials successfully. Failed batch not counted as attempts.
|
||||
|
||||
AOSS_Init_old initial 28.42298%
|
||||
- full-width wait counters instead of narrowing every update: 28.546717%; src 0x1758 base 0x18c0 insns 1494/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- packet length conversion retains full width: 28.42298%; src 0x1794 base 0x18c0 insns 1509/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
- poll arguments given semantic socket events structure: 28.42298%; src 0x1794 base 0x18c0 insns 1509/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b
|
||||
Retained best candidate
|
||||
|
||||
AOSS_813FFD68 initial 96.981735%
|
||||
- validation loops use signed char: 93.69406%; src 0x364 base 0x36c insns 217/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- return failure immediately on invalid character: 82.05023%; src 0x2ec base 0x36c insns 187/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- ascending validation cursor loop: 94.76712%; src 0x374 base 0x36c insns 221/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814001B4 initial 88.78481%
|
||||
- converted packet length stays full width: 88.78481%; src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- direct opcode return cases: 83.27848%; src 0x124 base 0x13c insns 73/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- full-width validation and branch nesting: no source change; skipped
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814002F0 initial 79.525%
|
||||
- read manufacturer only after state validation: 85.058334%; src 0x1c4 base 0x1e0 insns 113/120; --- replace mine 6:8 base 6:8; M 6 mr r30, r3; M 7 mr r26, r4
|
||||
- packet sequence values remain full-width: 76.441666%; src 0x1c4 base 0x1e0 insns 113/120; --- replace mine 5:7 base 5:8; M 5 mr r30, r3; M 6 mr r26, r4
|
||||
- direct address error branch: 79.525%; src 0x1c8 base 0x1e0 insns 114/120; --- replace mine 5:7 base 5:8; M 5 mr r30, r3; M 6 mr r26, r4
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81400830 initial 77.619934%
|
||||
- single-byte RC4 generation loop instead of manual pairs: 65.65109%; src 0x3c0 base 0x504 insns 240/321; --- insert mine 6:6 base 6:7; B 6 addi r29, r3, 0x18; --- insert mine 7:7 base 8:9
|
||||
- natural CRC byte loop: 60.13084%; src 0x3c4 base 0x504 insns 241/321; --- replace mine 5:6 base 5:7; M 5 mr r27, r3; B 5 mr r26, r3
|
||||
- narrow RC4 state indices at assignment: 77.619934%; src 0x4b8 base 0x504 insns 302/321; --- insert mine 6:6 base 6:7; B 6 addi r29, r3, 0x18; --- insert mine 7:7 base 8:9
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81400E0C initial 77.52105%
|
||||
- signed option lengths and iteration indices: 77.778946%; src 0x2bc base 0x2f8 insns 175/190; --- insert mine 5:5 base 5:6; B 5 mr r29, r4; --- replace mine 6:8 base 7:8
|
||||
- natural integer byte decode for both address options: 44.963158%; src 0x188 base 0x2f8 insns 98/190; --- insert mine 5:5 base 5:6; B 5 mr r29, r4; --- replace mine 6:8 base 7:8
|
||||
- address decode accumulation uses OR: 61.963158%; src 0x284 base 0x2f8 insns 161/190; --- replace mine 5:8 base 5:8; M 5 mr r29, r3; M 6 mr r30, r4
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814013AC initial 91.70175%
|
||||
- signed option lengths: 91.70175%; src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
- apply flags after successful parser call: 84.68421%; src 0x1ec base 0x1c8 insns 123/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
- bounded while loop over selected reply payload: 88.2807%; src 0x1d4 base 0x1c8 insns 117/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401574 initial 92.558136%
|
||||
- semantic payload extent expression: 92.558136%; src 0x1fc base 0x204 insns 127/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4
|
||||
- request length remains full-width: 92.209305%; src 0x1f8 base 0x204 insns 126/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4
|
||||
- initialize destination length before port conversion: 88.31783%; src 0x1fc base 0x204 insns 127/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401778 initial 71.93407%
|
||||
- CRC checksum stays full width until header store: 71.93407%; src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
- signed RC4 byte loop index: 71.93407%; src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
- copy hello payload before manufacturer encoding: 71.91575%; src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0)
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401C9C initial 71.9315%
|
||||
- natural RC4 state initialization loop: 43.342464%; src 0x98 base 0x124 insns 38/73; --- replace mine 0:1 base 0:2; M 0 li r9, 0; B 0 stwu r1, -0x10(r1)
|
||||
- schedule state reset before obtaining byte pointer: 71.9315%; src 0x12c base 0x124 insns 75/73; --- replace mine 0:6 base 0:2; M 0 stwu r1, -0x20(r1); M 1 mflr r0
|
||||
- signed key and state indices: 71.9315%; src 0x12c base 0x124 insns 75/73; --- replace mine 0:6 base 0:2; M 0 stwu r1, -0x20(r1); M 1 mflr r0
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401E80 initial 91.80272%
|
||||
- natural XOR loop over half-packet: 56.455784%; src 0x168 base 0x24c insns 90/147; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x30(r1); B 0 stwu r1, -0x40(r1)
|
||||
- half-length via signed division: 87.04082%; src 0x240 base 0x24c insns 144/147; --- replace mine 5:19 base 5:13; M 5 srawi r0, r4, 1; M 6 mr r28, r3
|
||||
- count-down rounds: 88.734695%; src 0x244 base 0x24c insns 145/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814020CC initial 76.066666%
|
||||
- sleep tick product stays 64-bit: 67.51667%; src 0xfc base 0xf0 insns 63/60; --- replace mine 3:6 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- tick duration via explicit multiply-high: 81.65%; src 0xe4 base 0xf0 insns 57/60; --- replace mine 3:5 base 3:6; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- do-while host acquisition loop: 65.066666%; src 0xf8 base 0xf0 insns 62/60; --- replace mine 3:6 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
Retained best candidate
|
||||
|
||||
AOSS_81401DC0 initial 99.375%
|
||||
- CRC output accumulator reuses incoming seed value: 99.375%; src 0xc0 base 0xc0 insns 48/48; diffs 4: [39, 41, 42, 43]; 39 M srwi r0, r3, 1; B srwi r3, r3, 1
|
||||
- last CRC bit combined with conditional polynomial: 80.916664%; src 0xc8 base 0xc0 insns 50/48; --- delete mine 0:1 base 0:0; M 0 lis r3, -0x1247; --- replace mine 2:4 base 1:2
|
||||
- ordinary counted loop for eight CRC polynomial steps: 24.833334%; src 0x40 base 0xc0 insns 16/48; --- insert mine 0:0 base 0:1; B 0 li r0, 0x100; --- delete mine 1:3 base 2:2
|
||||
Retained best candidate
|
||||
|
||||
AOSS_Init_old initial 28.546717%
|
||||
- network settings alignment follows target 32-byte stack contract: 24.69697%; src 0x17f8 base 0x18c0 insns 1534/1584; --- replace mine 8:9 base 8:11; M 8 li r14, 0; B 8 lhz r4, 0(0)
|
||||
- request records alignment follows target stack offset a0: 24.69697%; src 0x17f8 base 0x18c0 insns 1534/1584; --- replace mine 8:9 base 8:11; M 8 li r14, 0; B 8 lhz r4, 0(0)
|
||||
- both network settings and request records use observed stack alignment: 24.69697%; src 0x17f8 base 0x18c0 insns 1534/1584; --- replace mine 8:9 base 8:11; M 8 li r14, 0; B 8 lhz r4, 0(0)
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814001B4 initial 88.78481%
|
||||
- opcode uses full-width switch expression after conversion: 88.78481%; src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- rejection increments written as explicit count stores: 88.78481%; src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
- validation represented by a named result before rejection: 88.78481%; src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0
|
||||
Retained best candidate
|
||||
|
||||
AOSS_814013AC initial 91.70175%
|
||||
- outer response stride evaluated once before cursor advancement: 91.70175%; src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
- one option cursor serves outer and inner traversal: 91.70175%; src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
- config flags initialization delayed until matching response is located: 89.60526%; src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8
|
||||
Retained best candidate
|
||||
|
||||
AOSS .sbss source-order reconstruction: moved real existing address/status declarations into original address order; 28.57143 -> 57.14286.
|
||||
- explicit zero initialization of owned pointer globals: 42.857143%; original source restored if no improvement.
|
||||
- explicit zero initialization of runtime status globals: 57.14286%; original source restored if no improvement.
|
||||
- ordinary zero initialization of access-point address bytes: 28.57143%; original source restored if no improvement.
|
||||
|
||||
AOSS dispatch reconstruction: rejected empty/type/validation failures return immediately and opcode dispatch uses a switch; 41.518986 -> 88.78481%, 75/79 instructions. Remaining four instructions are prologue/epilogue save helpers versus individual register saves; three additional real source variations did not change them.
|
||||
AOSS_Init_old has a body for every observed state path; six distinct attempts logged. Restored narrow wait counters despite a small fuzzy gain from widening, because the original performs signed 16-bit wrapping assignments. Observed 32-byte stack alignment trials all worsened codegen and were restored. Renamed existing decompiler labels to meaningful state/cleanup names.
|
||||
AOSS .data/.bss/.sdata/.sdata2 remain 100%; ordinary source declaration reordering improves .sbss to 57.14286 but does not finish its symbol associations. Three normal initialization forms produced no further improvement and were restored. No forced sections, padding, address-pinning symbols, or table blobs added.
|
||||
|
||||
Current handoff: remaining functions and instruction evidence
|
||||
ATERM_814021BC 92.77922%: src 0x274 base 0x268 insns 157/154; --- replace mine 5:8 base 5:8; M 5 lis r31, 0; M 6 li r28, 0; M 7 addi r3, r31, 0
|
||||
ATERM_8140276C 94.04023%: src 0x2b0 base 0x2b8 insns 172/174; --- replace mine 5:11 base 5:13; M 5 mr r25, r3; M 6 mr r26, r4; M 7 mr r27, r5
|
||||
ATERM_81402A24 76.20532%: src 0x3f4 base 0x41c insns 253/263; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x80(r1); B 0 stwu r1, -0x90(r1); --- replace mine 2:4 base 2:4
|
||||
ATERM_81402E40 99.791664%: src 0x180 base 0x180 insns 96/96; diffs 4: [9, 10, 47, 52]; 9 M mr r29, r7; B mr r3, r27; 10 M mr r3, r27
|
||||
ATERM_81402FC0 68.577774%: src 0x208 base 0x21c insns 130/135; --- insert mine 8:8 base 8:9; B 8 li r31, 0; --- delete mine 15:16 base 16:16; M 15 li r31, 0
|
||||
ATERM_814031DC 85.90225%: src 0x1f4 base 0x214 insns 125/133; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x70(r1); B 0 stwu r1, -0x60(r1); --- replace mine 4:6 base 4:6
|
||||
ATERM_814033F0 67.39416%: src 0x214 base 0x224 insns 133/137; --- replace mine 5:6 base 5:6; M 5 addi r30, r3, 8; B 5 addi r29, r3, 8; --- insert mine 7:7 base 7:8
|
||||
ATERM_814036D8 87.0%: src 0x1e4 base 0x1f0 insns 121/124; --- replace mine 14:24 base 14:16; M 14 bne 36; M 15 addi r3, r25, 0; M 16 li r0, 4
|
||||
ATERM_814038C8 41.043114%: src 0x9b4 base 0xedc insns 621/951; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x140(r1); B 0 stwu r1, -0x180(r1); --- replace mine 2:4 base 2:4
|
||||
ATERMi_AutoConfigThread 94.75%: src 0xa0 base 0xa0 insns 40/40; diffs 3: [20, 22, 23]; 20 M nor r0, r3, r0; B nor r3, r3, r0; 22 M srawi r3, r0, 0x1f
|
||||
ATERM_81404844 92.62393%: src 0x1bc base 0x1d4 insns 111/117; --- replace mine 8:13 base 8:13; M 8 mr r29, r3; M 9 mr r22, r4; M 10 mr r23, r5
|
||||
ATERM_81404A18 75.82645%: src 0x1c0 base 0x1e4 insns 112/121; --- replace mine 8:13 base 8:14; M 8 mr r29, r3; M 9 mr r21, r4; M 10 mr r22, r5
|
||||
ATERM_81404BFC 74.36194%: src 0x46c base 0x430 insns 283/268; --- replace mine 6:7 base 6:7; M 6 cmplwi r5, 0x80; B 6 cmpwi r5, 0x80; --- delete mine 38:40 base 38:38
|
||||
ATERM_8140502C 42.355072%: src 0x280 base 0x228 insns 160/138; --- insert mine 5:5 base 5:8; B 5 stw r30, 8(r1); B 6 lis r30, 0; B 7 addi r30, r30, 0
|
||||
ATERM_81405254 34.23247%: src 0x3c4 base 0x43c insns 241/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1); --- replace mine 2:4 base 2:4
|
||||
ATERM_81405690 34.64945%: src 0x3d4 base 0x43c insns 245/271; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x40(r1); B 0 stwu r1, -0x50(r1); --- replace mine 2:4 base 2:4
|
||||
ATERM_81405ACC 55.54861%: src 0x21c base 0x240 insns 135/144; --- insert mine 2:2 base 2:3; B 2 slwi r7, r5, 3; --- replace mine 3:7 base 4:10; M 3 addi r11, r1, 0x20
|
||||
ATERM_81405D0C 53.851387%: src 0xa50 base 0xb40 insns 660/720; --- replace mine 0:1 base 0:1; M 0 stwu r1, -0x90(r1); B 0 stwu r1, -0xa0(r1); --- replace mine 2:4 base 2:4
|
||||
ATERMi_ApConfigStart 93.718445%: src 0x1a0 base 0x19c insns 104/103; --- delete mine 4:5 base 4:4; M 4 mr r31, r3; --- replace mine 6:7 base 5:6; M 6 mr r30, r8
|
||||
ATERMi_ApConfigEnd 87.54263%: src 0x1dc base 0x204 insns 119/129; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0xe0; M 4 bl 0; B 3 stw r31, 0xdc(r1)
|
||||
ATERMi_ApConfigGetState 99.42857%: src 0x8c base 0x8c insns 35/35; diffs 3: [17, 18, 20]; 17 M lwz r6, 0xf8(r6); B lwz r0, 0xf8(r6); 18 M addi r0, r5, 0x4dd3
|
||||
AOSS_Init_old 28.42298%: src 0x1794 base 0x18c0 insns 1509/1584; --- replace mine 0:1 base 0:4; M 0 stwu r1, -0x100(r1); B 0 clrlwi r11, r1, 0x1b; B 1 mr r12, r1
|
||||
AOSS_813FFD68 96.981735%: src 0x364 base 0x36c insns 217/219; --- replace mine 3:5 base 3:7; M 3 addi r11, r1, 0x20; M 4 bl 0; B 3 stw r31, 0x1c(r1)
|
||||
AOSS_814001B4 88.78481%: src 0x12c base 0x13c insns 75/79; --- replace mine 3:5 base 3:10; M 3 addi r11, r1, 0x20; M 4 bl 0; B 3 stw r31, 0x1c(r1)
|
||||
AOSS_814002F0 85.058334%: src 0x1c4 base 0x1e0 insns 113/120; --- replace mine 6:8 base 6:8; M 6 mr r30, r3; M 7 mr r26, r4; B 6 mr r26, r3
|
||||
AOSS_81400830 77.619934%: src 0x4b8 base 0x504 insns 302/321; --- insert mine 6:6 base 6:7; B 6 addi r29, r3, 0x18; --- insert mine 7:7 base 8:9; B 8 li r5, 8
|
||||
AOSS_81400E0C 77.778946%: src 0x2bc base 0x2f8 insns 175/190; --- insert mine 5:5 base 5:6; B 5 mr r29, r4; --- replace mine 6:8 base 7:8; M 6 mr r29, r4
|
||||
AOSS_814013AC 91.70175%: src 0x1cc base 0x1c8 insns 115/114; --- insert mine 6:6 base 6:7; B 6 mr r27, r3; --- delete mine 7:8 base 8:8; M 7 mr r27, r3
|
||||
AOSS_81401574 92.558136%: src 0x1fc base 0x204 insns 127/129; --- replace mine 5:7 base 5:7; M 5 lwz r30, 0(0); M 6 mr r27, r4; B 5 lwz r27, 0(0)
|
||||
AOSS_81401778 71.93407%: src 0x434 base 0x444 insns 269/273; --- replace mine 5:7 base 5:6; M 5 lis r31, 0; M 6 lwz r30, 0(0); B 5 lwz r28, 0(0)
|
||||
AOSS_81401C9C 71.9315%: src 0x12c base 0x124 insns 75/73; --- replace mine 0:6 base 0:2; M 0 stwu r1, -0x20(r1); M 1 mflr r0; M 2 stw r0, 0x24(r1)
|
||||
AOSS_81401DC0 99.375%: src 0xc0 base 0xc0 insns 48/48; diffs 4: [39, 41, 42, 43]; 39 M srwi r0, r3, 1; B srwi r3, r3, 1; 41 M xoris r0, r0, 0xedb8
|
||||
AOSS_81401E80 91.80272%: src 0x244 base 0x24c insns 145/147; --- replace mine 6:7 base 6:7; M 6 mr r28, r3; B 6 mr r21, r3; --- replace mine 8:20 base 8:13
|
||||
AOSS_814020CC 81.65%: src 0xe4 base 0xf0 insns 57/60; --- replace mine 3:5 base 3:6; M 3 addi r11, r1, 0x20; M 4 bl 0; B 3 stw r31, 0x1c(r1)
|
||||
|
||||
Supplemental native crypto validation: NIST AES-128/192/256 encrypt/decrypt vectors passed; MD5 lengths 0, 1, 3, 55, 56, 64, 130 and streaming chunks 1, 7, 55, 63, 64, 65, 127 over 512 bytes passed against hashlib. RFC3394 wrap/unwrap passed using a temporary native test copy that explicitly emulates Wii big-endian counter bytes; unchanged x86 union byte order does not emulate the target. Tests reside under /tmp; MWCC object and gate remain matching authority.
|
||||
@@ -11,23 +11,12 @@ splits: 'config/43U/splits.txt'
|
||||
ldscript_template: 'config/ldscript_ipl2.lcf'
|
||||
|
||||
force_active:
|
||||
- fprintf
|
||||
- leap_days
|
||||
- __msl_time2tm
|
||||
- __tm2time
|
||||
- clock
|
||||
- mktime
|
||||
- localtime
|
||||
- emit
|
||||
- __MSL_ISO8601NewYear
|
||||
- __MSL_ISO8601Week
|
||||
- strftime
|
||||
- labs
|
||||
- atol
|
||||
- itoa
|
||||
- strpbrk
|
||||
- strspn
|
||||
- strcspn
|
||||
- atol
|
||||
- padding__Q23ipl5scene
|
||||
- lbl_81695063
|
||||
- lbl_81695067
|
||||
|
||||
@@ -1111,7 +1111,7 @@ src/keyboard/MyTiInputForm.cpp:
|
||||
|
||||
src/keyboard/MyTiLetterForm.cpp:
|
||||
.text start:0x81444730 end:0x814454D8
|
||||
.rodata start:0x816168B8 end:0x81616BC8
|
||||
.rodata start:0x816168B8 end:0x81616B88
|
||||
.data start:0x81668860 end:0x81668CD8
|
||||
.sdata2 start:0x81694EB0 end:0x81694ED0
|
||||
.sdata start:0x81697528 end:0x81697570
|
||||
@@ -1138,7 +1138,7 @@ src/keyboard/tiHKBManager.cpp:
|
||||
src/keyboard/tiHwKeyboard.cpp:
|
||||
.bss start:0x810C8940 end:0x810C8950
|
||||
.text start:0x81448AA4 end:0x81449C98
|
||||
.rodata start:0x81616BC8 end:0x81616C78
|
||||
.rodata start:0x81616B88 end:0x81616C78
|
||||
.data start:0x81668EF8 end:0x81669018
|
||||
.sdata2 start:0x81694EF8 end:0x81694F08
|
||||
.sdata start:0x81697570 end:0x81697578
|
||||
@@ -1405,7 +1405,7 @@ libs/RVLMiddleware/eZiText/src/clib/zikorean.c:
|
||||
extab start:0x81330748 end:0x81330760
|
||||
extabindex start:0x8133147C end:0x813314A0
|
||||
.text start:0x814813FC end:0x81482840
|
||||
.data start:0x8166B2B0 end:0x8166B3A8
|
||||
.data start:0x8166B2B0 end:0x8166B3D0
|
||||
|
||||
libs/RVLMiddleware/eZiText/src/clib/ziswordw.c:
|
||||
extab start:0x81330760 end:0x81330770
|
||||
@@ -1417,7 +1417,6 @@ libs/RVLMiddleware/eZiText/src/clib/zkokeyp.c:
|
||||
extab start:0x81330770 end:0x813307A8
|
||||
extabindex start:0x813314B8 end:0x8133150C
|
||||
.text start:0x8148302C end:0x8148447C
|
||||
.data start:0x8166B3A8 end:0x8166B3D0
|
||||
|
||||
libs/RVLMiddleware/eZiText/src/clib/zierror.c:
|
||||
.text start:0x8148447C end:0x81484484
|
||||
@@ -4193,11 +4192,11 @@ libs/RVL_SDK/src/fa/driver/nand_drv.c:
|
||||
.sbss start:0x816996C0 end:0x816996E0
|
||||
|
||||
libs/RVL_SDK/src/fa/driver/sd_drv.c:
|
||||
.bss start:0x811AF460 end:0x811AF6C0 align:32
|
||||
.bss start:0x811AF460 end:0x811AF6C0
|
||||
.text start:0x815EA41C end:0x815ED20C
|
||||
.rodata start:0x816329E8 end:0x81632B58
|
||||
.data start:0x81690D18 end:0x81691728
|
||||
.sbss start:0x816996E0 end:0x81699708 align:32
|
||||
.sbss start:0x816996E0 end:0x81699708
|
||||
|
||||
libs/RVL_SDK/src/fa/driver/pfd_cmn.c:
|
||||
.text start:0x815ED20C end:0x815ED324
|
||||
|
||||
@@ -2042,8 +2042,8 @@ isEqualChannel__Q33ipl8savedata7ManagerFUxUx = .text:0x813594B0; // type:functio
|
||||
isDefaultChannel__Q33ipl8savedata7ManagerFUlUl = .text:0x8135954C; // type:function size:0x50
|
||||
updateVersion__Q33ipl8savedata7ManagerFUlUl = .text:0x8135959C; // type:function size:0xD4
|
||||
setDefaultSDMenu__Q33ipl8savedata7ManagerFv = .text:0x81359670; // type:function size:0x48 scope:local
|
||||
pushTitleCache__Q33ipl8savedata7ManagerFUx = .text:0x813596B8; // type:function size:0xE8
|
||||
isTitleCached = .text:0x813597A0; // type:function size:0x40
|
||||
iplSavedata_813596B8__Q33ipl8savedata7ManagerFUx = .text:0x813596B8; // type:function size:0xE8
|
||||
iplSavedata_813597A0 = .text:0x813597A0; // type:function size:0x40 scope:local
|
||||
nand_error_handling__Q33ipl8savedata7ManagerFi = .text:0x813597E0; // type:function size:0xDC
|
||||
__ct__Q33ipl7channel9RsoThreadFPQ23EGG4Heap = .text:0x813598BC; // type:function size:0x6C
|
||||
__dt__Q33ipl7channel9RsoThreadFv = .text:0x81359928; // type:function size:0x70
|
||||
@@ -2095,7 +2095,7 @@ stt_wait_fns_msg__Q23ipl9CdbBackupFv = .text:0x8135B004; // type:function size:0
|
||||
stt_clean_up_back__Q23ipl9CdbBackupFv = .text:0x8135B030; // type:function size:0x60
|
||||
stt_wait_terminate__Q23ipl9CdbBackupFv = .text:0x8135B090; // type:function size:0x60
|
||||
error_handling__Q23ipl9CdbBackupFv = .text:0x8135B0F0; // type:function size:0xD0
|
||||
getProgressPercent__Q23ipl9CdbBackupFv = .text:0x8135B1C0; // type:function size:0x28
|
||||
fn_8135B1C0__Q23ipl9CdbBackupFv = .text:0x8135B1C0; // type:function size:0x28
|
||||
cdb_backup_delete_search_cb___3iplFPvP10_CDBRecord = .text:0x8135B1E8; // type:function size:0x8C
|
||||
cdb_backup_delete_task___3iplFPv = .text:0x8135B274; // type:function size:0xDC
|
||||
cdb_backup_move_search_cb___3iplFPvP10_CDBRecord = .text:0x8135B350; // type:function size:0xBC
|
||||
@@ -5126,8 +5126,8 @@ __ct__Q33ipl5scene10AOSSThreadFPQ23EGG4Heap = .text:0x813FCA0C; // type:function
|
||||
destroy__Q33ipl5scene10AOSSThreadFi = .text:0x813FCAA0; // type:function size:0x84
|
||||
__dt__Q33ipl5scene10AOSSThreadFv = .text:0x813FCB24; // type:function size:0x70
|
||||
start__Q33ipl5scene10AOSSThreadFv = .text:0x813FCB94; // type:function size:0xF8
|
||||
aossAlloc__Q33ipl5scene10AOSSThreadFv = .text:0x813FCC8C; // type:function size:0x58
|
||||
aossFree__Q33ipl5scene10AOSSThreadFv = .text:0x813FCCE4; // type:function size:0x50
|
||||
AOSSThread_813FCC8C__Q33ipl5scene10AOSSThreadFv = .text:0x813FCC8C; // type:function size:0x58
|
||||
AOSSThread_813FCCE4__Q33ipl5scene10AOSSThreadFv = .text:0x813FCCE4; // type:function size:0x50
|
||||
Run__Q33ipl5scene10AOSSThreadFv = .text:0x813FCD34; // type:function size:0xEC
|
||||
cancel__Q33ipl5scene10AOSSThreadFv = .text:0x813FCE20; // type:function size:0x50
|
||||
finish__Q33ipl5scene10AOSSThreadFP13NCDAossConfigPi = .text:0x813FCE70; // type:function size:0x2FC
|
||||
@@ -5829,7 +5829,7 @@ doAfterDrawProcess__Q39textinput9inputform4BaseFPCwUlRCQ49textinput10textdrawer4
|
||||
finishDraw__Q39textinput9inputform4BaseFUl = .text:0x81427DC0; // type:function size:0x4
|
||||
addSender__Q29textinput15CommandReceiverFPQ29textinput13CommandSender = .text:0x81427DC4; // type:function size:0x8
|
||||
getDrawModifyStartLine__Q39textinput10textdrawer4BaseCFv = .text:0x81427DCC; // type:function size:0x8
|
||||
isEnableCursorCache__Q39textinput10textdrawer4BaseCFv = .text:0x81427DD4; // type:function size:0x8
|
||||
isEnableCursorCache__Q39textinput10textdrawer4BaseCFvgetStartPos__Q39textinput10textdrawer4BaseCFv = .text:0x81427DD4; // type:function size:0x8
|
||||
getStartPos__Q39textinput10textdrawer4BaseCFv = .text:0x81427DDC; // type:function size:0x8
|
||||
setVIWidth__Q39textinput10textdrawer4BaseFf = .text:0x81427DE4; // type:function size:0x8
|
||||
setCandidateBox__Q39textinput12candidatebox18CandidateBoxCallerFPQ39textinput12candidatebox4Base = .text:0x81427DEC; // type:function size:0x8
|
||||
@@ -13113,7 +13113,7 @@ pfstub_com_massage = .text:0x815E6C40; // type:function size:0xE4
|
||||
pfstub_store_result = .text:0x815E6D24; // type:function size:0xC4
|
||||
PFSYS_initializeSYS = .text:0x815E6DE8; // type:function size:0x4
|
||||
PFSYS_GetCurrentContextID = .text:0x815E6DEC; // type:function size:0x18
|
||||
PFSYS_TimeStamp = .text:0x815E6E04; // type:function size:0x7C
|
||||
PFSYS_TimeStamp = .text:0x815E6E04; // type:function size:0x74
|
||||
pfstub_call_function_standard = .text:0x815E6E80; // type:function size:0x584
|
||||
pfstub_attach = .text:0x815E7404; // type:function size:0x50
|
||||
pfstub_buffering = .text:0x815E7454; // type:function size:0x50
|
||||
@@ -13202,7 +13202,7 @@ pfd_sddrv_pread = .text:0x815EAADC; // type:function size:0x38
|
||||
pfd_sddrv_pwrite = .text:0x815EAB14; // type:function size:0x38
|
||||
pfd_sddrv_unmount = .text:0x815EAB4C; // type:function size:0x34
|
||||
pfd_sddrv_finalize = .text:0x815EAB80; // type:function size:0xE4
|
||||
pfd_sddrv_get_disk_info = .text:0x815EAC64; // type:function size:0x188
|
||||
pfd_sddrv_get_disk_info = .text:0x815EAC64; // type:function size:0x180
|
||||
pfd_sddrv_init_drv_tbl = .text:0x815EADEC; // type:function size:0x18
|
||||
pfd_sddrv_registar_callback = .text:0x815EAE04; // type:function size:0x10
|
||||
pfd_sddrv_is_media_insert = .text:0x815EAE14; // type:function size:0x98
|
||||
@@ -21753,7 +21753,7 @@ lbl_816966E1 = .sdata:0x816966E1; // type:object size:0x6 data:string
|
||||
lbl_816966E7 = .sdata:0x816966E7; // type:object size:0x7 data:string
|
||||
lbl_816966EE = .sdata:0x816966EE; // type:object size:0x7 data:string
|
||||
lbl_816966F5 = .sdata:0x816966F5; // type:object size:0x4 data:string
|
||||
scPaneName_B_Stop = .sdata:0x816966F9; // type:object size:0x7 data:string
|
||||
lbl_816966F9 = .sdata:0x816966F9; // type:object size:0x7 data:string
|
||||
lbl_81696700 = .sdata:0x81696700; // type:object size:0x6 data:string
|
||||
lbl_81696706 = .sdata:0x81696706; // type:object size:0x5 data:string
|
||||
lbl_8169670B = .sdata:0x8169670B; // type:object size:0x6 data:string
|
||||
@@ -21781,7 +21781,7 @@ lbl_81696797 = .sdata:0x81696797; // type:object size:0x8 data:string
|
||||
lbl_8169679F = .sdata:0x8169679F; // type:object size:0x8 data:string
|
||||
lbl_816967A7 = .sdata:0x816967A7; // type:object size:0x7 data:string
|
||||
lbl_816967AE = .sdata:0x816967AE; // type:object size:0x7 data:string
|
||||
scPaneName_T_Stop = .sdata:0x816967B5; // type:object size:0x7 data:string
|
||||
lbl_816967B5 = .sdata:0x816967B5; // type:object size:0x7 data:string
|
||||
lbl_816967C0 = .sdata:0x816967C0; // type:object size:0x4 data:string
|
||||
lbl_816967C4 = .sdata:0x816967C4; // type:object size:0x6 data:string
|
||||
lbl_816967CA = .sdata:0x816967CA; // type:object size:0x7 data:string
|
||||
@@ -23191,7 +23191,7 @@ _repeatBitLength__7LibTVRC = .sbss:0x81698768; // type:object size:0x4 data:4byt
|
||||
_repeatBitArray__7LibTVRC = .sbss:0x8169876C; // type:object size:0x4 data:4byte
|
||||
_tickT__7LibTVRC = .sbss:0x81698770; // type:object size:0x4 data:4byte
|
||||
m_handle__Q23ipl11TVRCManager = .sbss:0x81698778; // type:object size:0x4 data:4byte
|
||||
sTvrcStartDelay__3ipl = .sbss:0x8169877C; // type:object size:0x4 data:4byte
|
||||
lbl_8169877C__3ipl = .sbss:0x8169877C; // type:object size:0x4 data:4byte
|
||||
suIDCounter__Q23gui11PaneManager = .sbss:0x81698780; // type:object size:0x4 data:4byte
|
||||
_bgmBlk__Q23ipl3snd = .sbss:0x81698788; // type:object size:0x4
|
||||
_mainBGMHandle__Q23ipl3snd = .sbss:0x8169878C; // type:object size:0x4 data:4byte
|
||||
@@ -23331,7 +23331,7 @@ opera_callbacks__Q23www10wiisetting = .sbss:0x816989A0; // type:object size:0x4
|
||||
sStatus__Q23www9arcreader = .sbss:0x816989A8; // type:object size:0x4 scope:local data:4byte
|
||||
lbl_816989B0 = .sbss:0x816989B0; // type:object size:0x4 data:4byte
|
||||
sBatteryFlag__Q210homebutton10Controller = .sbss:0x816989B8; // type:object size:0x4
|
||||
sAlarmCreated__Q210homebutton10Controller = .sbss:0x816989BC; // type:object size:0x4
|
||||
lbl_816989BC__Q210homebutton10Controller = .sbss:0x816989BC; // type:object size:0x4
|
||||
suIDCounter__Q310homebutton3gui11PaneManager = .sbss:0x816989C0; // type:object size:0x4 data:4byte
|
||||
spInstance__Q210homebutton9RemoteSpk = .sbss:0x816989C8; // type:object size:0x4 data:4byte
|
||||
InvalidShutdown = .sbss:0x816989D0; // type:object size:0x4 data:4byte
|
||||
|
||||
344
configure.py
344
configure.py
@@ -812,8 +812,8 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("memoryCard", [
|
||||
Object(Matching, "scene/memoryCard/iplMemoryCard.cpp"),
|
||||
Object(Matching, "scene/memoryCard/iplMemoryCardBase.cpp"),
|
||||
Object(NonMatching, "scene/memoryCard/iplMemoryCard.cpp"),
|
||||
Object(NonMatching, "scene/memoryCard/iplMemoryCardBase.cpp"),
|
||||
Object(NonMatching, "scene/memoryCard/iplMemoryCardManager.cpp"),
|
||||
Object(Matching, "scene/memoryCard/iplGCSaveData.cpp"),
|
||||
Object(NonMatching, "scene/memoryCard/iplGCWindow.cpp"),
|
||||
@@ -878,8 +878,8 @@ config.libs = [
|
||||
Object(Matching, "scene/setting/iplAOSSThread.cpp"),
|
||||
Object(NonMatching, "scene/setting/AOSSLink.c"),
|
||||
Object(NonMatching, "scene/setting/iplRakuRakuThread.cpp"),
|
||||
Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline off"]),
|
||||
Object(NonMatching, "scene/setting/ATERM.c", extra_cflags=["-O4,p", "-inline off"]),
|
||||
Object(NonMatching, "scene/setting/AOSS.c"),
|
||||
Object(NonMatching, "scene/setting/ATERM.c"),
|
||||
]
|
||||
),
|
||||
IPLSection("settingSelect", [
|
||||
@@ -929,7 +929,7 @@ config.libs = [
|
||||
Object(Matching, "keyboard/tiTextInputBase.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/MyTiManager.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/MyTiInputForm.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/MyTiLetterForm.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/MyTiLetterForm.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/MyTiBg.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiDebug.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiGUIManager.cpp", extra_cflags=["-O4,p"]),
|
||||
@@ -987,7 +987,7 @@ config.libs = [
|
||||
Object(NonMatching, "clib/zi8alpha.c"),
|
||||
Object(Matching, "clib/zi8alts.c"),
|
||||
Object(NonMatching, "clib/zi8cgetc.c"),
|
||||
Object(Matching, "clib/zi8cinfo.c"),
|
||||
Object(NonMatching, "clib/zi8cinfo.c"),
|
||||
Object(Matching, "clib/zi8copy.c"),
|
||||
Object(NonMatching, "clib/zi8dawg.c"),
|
||||
Object(Matching, "clib/zi8getc.c"),
|
||||
@@ -1004,7 +1004,7 @@ config.libs = [
|
||||
Object(Matching, "clib/zi8ver.c"),
|
||||
Object(Matching, "clib/zi8ZHuwd.c"),
|
||||
Object(NonMatching, "clib/zidawg1.c"),
|
||||
Object(Matching, "clib/zikorean.c"),
|
||||
Object(NonMatching, "clib/zikorean.c"),
|
||||
Object(NonMatching, "clib/ziswordw.c"),
|
||||
Object(NonMatching, "clib/zkokeyp.c"),
|
||||
Object(Matching, "clib/zierror.c"),
|
||||
@@ -1025,7 +1025,7 @@ config.libs = [
|
||||
Object(NonMatching, "cdb/CDBRecord.c"),
|
||||
Object(Matching, "cdb/CDBRecordFile.c"),
|
||||
Object(Matching, "cdb/CDBRecordKey.c"),
|
||||
Object(Matching, "cdb/CDBIntArray.c"),
|
||||
Object(NonMatching, "cdb/CDBIntArray.c"),
|
||||
Object(Matching, "cdb/CDBSystem.c"),
|
||||
Object(Matching, "cdb/CDBAttr.c"),
|
||||
Object(Matching, "cdb/CDBFBridge.c"),
|
||||
@@ -1037,16 +1037,16 @@ config.libs = [
|
||||
),
|
||||
RevoEXLib("ncd", [
|
||||
Object(Matching, "ncd/ncdsystem.c"),
|
||||
Object(Matching, "ncd/ncdsleep.c"),
|
||||
Object(NonMatching, "ncd/ncdsleep.c"),
|
||||
]
|
||||
),
|
||||
RevoEXLib("net", [
|
||||
Object(Matching, "net/nettime.c"),
|
||||
Object(Matching, "net/crc.c"),
|
||||
Object(NonMatching, "net/md5.c"),
|
||||
Object(Matching, "net/sha1.c"),
|
||||
Object(NonMatching, "net/sha1.c"),
|
||||
Object(NonMatching, "net/hmac.c"),
|
||||
Object(Matching, "net/neterrorcode.c"),
|
||||
Object(NonMatching, "net/neterrorcode.c"),
|
||||
Object(Matching, "net/NETVersion.c"),
|
||||
Object(NonMatching, "net/aes.c"),
|
||||
Object(Matching, "net/wireless_macaddr.c"),
|
||||
@@ -1091,7 +1091,7 @@ config.libs = [
|
||||
Object(Matching, "nwc24/NWC24Ipc.c"),
|
||||
Object(Equivalent, "nwc24/NWC24Download.c"),
|
||||
Object(Matching, "nwc24/NWC24CHJump.c"),
|
||||
Object(Matching, "nwc24/NWC24System.c"),
|
||||
Object(NonMatching, "nwc24/NWC24System.c"),
|
||||
]
|
||||
),
|
||||
RevoEXLib("so", [
|
||||
@@ -1389,8 +1389,8 @@ config.libs = [
|
||||
),
|
||||
RVLSDKLib("vi", [
|
||||
Object(NonMatching, "vi/vi.c"),
|
||||
Object(Matching, "vi/i2c.c"),
|
||||
Object(Matching, "vi/vi3in1.c"),
|
||||
Object(NonMatching, "vi/i2c.c"),
|
||||
Object(NonMatching, "vi/vi3in1.c"),
|
||||
]
|
||||
),
|
||||
RVLSDKLib("mtx", [
|
||||
@@ -1448,10 +1448,10 @@ config.libs = [
|
||||
Object(Matching, "axfx/AXFXReverbHi.c"),
|
||||
Object(Matching, "axfx/AXFXReverbHiDpl2.c"),
|
||||
Object(Matching, "axfx/AXFXReverbHiExp.c"),
|
||||
Object(Matching, "axfx/AXFXReverbHiExpDpl2.c"),
|
||||
Object(NonMatching, "axfx/AXFXReverbHiExpDpl2.c"),
|
||||
Object(Matching, "axfx/AXFXDelay.c"),
|
||||
Object(Matching, "axfx/AXFXReverbStd.c"),
|
||||
Object(Matching, "axfx/AXFXReverbStdExp.c"),
|
||||
Object(NonMatching, "axfx/AXFXReverbStdExp.c"),
|
||||
Object(Matching, "axfx/AXFXChorus.c"),
|
||||
Object(NonMatching, "axfx/AXFXChorusExp.c"),
|
||||
Object(Matching, "axfx/AXFXLfoTable.c"),
|
||||
@@ -1552,7 +1552,7 @@ config.libs = [
|
||||
),
|
||||
RVLSDKLib("wpad", [
|
||||
Object(Matching, "wpad/WPAD.c"),
|
||||
Object(Matching, "wpad/WPADHIDParser.c"),
|
||||
Object(NonMatching, "wpad/WPADHIDParser.c"),
|
||||
Object(Matching, "wpad/WPADMem.c"),
|
||||
Object(Matching, "wpad/WPADEncrypt.c"),
|
||||
Object(Matching, "wpad/debug_msg.c"),
|
||||
@@ -1682,184 +1682,184 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
RVLSDKLib("fa", [
|
||||
Object(Matching, "fa/pf_clib.c"),
|
||||
Object(Matching, "fa/pf_code.c"),
|
||||
Object(Matching, "fa/pf_service.c"),
|
||||
Object(Matching, "fa/pf_str.c"),
|
||||
Object(Matching, "fa/pf_driver.c"),
|
||||
Object(Matching, "fa/pdm_api.c"),
|
||||
Object(Matching, "fa/pdm_bpb.c"),
|
||||
Object(Matching, "fa/pdm_disk.c"),
|
||||
Object(NonMatching, "fa/pf_clib.c"),
|
||||
Object(NonMatching, "fa/pf_code.c"),
|
||||
Object(NonMatching, "fa/pf_service.c"),
|
||||
Object(NonMatching, "fa/pf_str.c"),
|
||||
Object(NonMatching, "fa/pf_driver.c"),
|
||||
Object(NonMatching, "fa/pdm_api.c"),
|
||||
Object(NonMatching, "fa/pdm_bpb.c"),
|
||||
Object(NonMatching, "fa/pdm_disk.c"),
|
||||
Object(NonMatching, "fa/pdm_partition.c"),
|
||||
Object(NonMatching, "fa/pf_cache.c"),
|
||||
Object(NonMatching, "fa/pf_cluster.c"),
|
||||
Object(NonMatching, "fa/pf_dir.c"),
|
||||
Object(Matching, "fa/pf_entry.c"),
|
||||
Object(NonMatching, "fa/pf_entry.c"),
|
||||
Object(NonMatching, "fa/pf_entry_iterator.c"),
|
||||
Object(NonMatching, "fa/pf_fat.c"),
|
||||
Object(NonMatching, "fa/pf_fat12.c"),
|
||||
Object(Matching, "fa/pf_fat16.c"),
|
||||
Object(Matching, "fa/pf_fat32.c"),
|
||||
Object(NonMatching, "fa/pf_fat16.c"),
|
||||
Object(NonMatching, "fa/pf_fat32.c"),
|
||||
Object(Matching, "fa/pf_fatfs.c"),
|
||||
Object(NonMatching, "fa/pf_file.c"),
|
||||
Object(NonMatching, "fa/pf_path.c"),
|
||||
Object(Matching, "fa/pf_sector.c"),
|
||||
Object(NonMatching, "fa/pf_sector.c"),
|
||||
Object(NonMatching, "fa/pf_volume.c"),
|
||||
Object(Matching, "fa/pf_volume_apiadd.c"),
|
||||
Object(Matching, "fa/pf_cp932.c"),
|
||||
Object(NonMatching, "fa/pf_volume_apiadd.c"),
|
||||
Object(NonMatching, "fa/pf_cp932.c"),
|
||||
Object(Matching, "fa/pf_api_util.c"),
|
||||
Object(Matching, "fa/pf_attach.c"),
|
||||
Object(Matching, "fa/pf_buffering.c"),
|
||||
Object(Matching, "fa/pf_cdelete.c"),
|
||||
Object(Matching, "fa/pf_chdir.c"),
|
||||
Object(Matching, "fa/pf_chdmod.c"),
|
||||
Object(Matching, "fa/pf_chmod.c"),
|
||||
Object(Matching, "fa/pf_cinsert.c"),
|
||||
Object(NonMatching, "fa/pf_attach.c"),
|
||||
Object(NonMatching, "fa/pf_buffering.c"),
|
||||
Object(NonMatching, "fa/pf_cdelete.c"),
|
||||
Object(NonMatching, "fa/pf_chdir.c"),
|
||||
Object(NonMatching, "fa/pf_chdmod.c"),
|
||||
Object(NonMatching, "fa/pf_chmod.c"),
|
||||
Object(NonMatching, "fa/pf_cinsert.c"),
|
||||
Object(Matching, "fa/pf_closedir.c"),
|
||||
Object(Matching, "fa/pf_combine.c"),
|
||||
Object(Matching, "fa/pf_create.c"),
|
||||
Object(Matching, "fa/pf_createdir.c"),
|
||||
Object(Matching, "fa/pf_cut.c"),
|
||||
Object(Matching, "fa/pf_derrnum.c"),
|
||||
Object(Matching, "fa/pf_detach.c"),
|
||||
Object(Matching, "fa/pf_divide.c"),
|
||||
Object(NonMatching, "fa/pf_combine.c"),
|
||||
Object(NonMatching, "fa/pf_create.c"),
|
||||
Object(NonMatching, "fa/pf_createdir.c"),
|
||||
Object(NonMatching, "fa/pf_cut.c"),
|
||||
Object(NonMatching, "fa/pf_derrnum.c"),
|
||||
Object(NonMatching, "fa/pf_detach.c"),
|
||||
Object(NonMatching, "fa/pf_divide.c"),
|
||||
Object(Matching, "fa/pf_errnum.c"),
|
||||
Object(Matching, "fa/pf_fadjust.c"),
|
||||
Object(Matching, "fa/pf_fappend.c"),
|
||||
Object(Matching, "fa/pf_fchdir.c"),
|
||||
Object(NonMatching, "fa/pf_fadjust.c"),
|
||||
Object(NonMatching, "fa/pf_fappend.c"),
|
||||
Object(NonMatching, "fa/pf_fchdir.c"),
|
||||
Object(Matching, "fa/pf_fclose.c"),
|
||||
Object(Matching, "fa/pf_fconcat.c"),
|
||||
Object(NonMatching, "fa/pf_fconcat.c"),
|
||||
Object(Matching, "fa/pf_feof.c"),
|
||||
Object(Matching, "fa/pf_ferror.c"),
|
||||
Object(Matching, "fa/pf_finfo.c"),
|
||||
Object(NonMatching, "fa/pf_finfo.c"),
|
||||
Object(Matching, "fa/pf_flock.c"),
|
||||
Object(Matching, "fa/pf_fopen.c"),
|
||||
Object(Matching, "fa/pf_format.c"),
|
||||
Object(NonMatching, "fa/pf_fopen.c"),
|
||||
Object(NonMatching, "fa/pf_format.c"),
|
||||
Object(Matching, "fa/pf_fread.c"),
|
||||
Object(Matching, "fa/pf_fseek.c"),
|
||||
Object(Matching, "fa/pf_fsetclstlink.c"),
|
||||
Object(Matching, "fa/pf_fsexec.c"),
|
||||
Object(Matching, "fa/pf_fsfirst.c"),
|
||||
Object(Matching, "fa/pf_fsnext.c"),
|
||||
Object(Matching, "fa/pf_fstat.c"),
|
||||
Object(NonMatching, "fa/pf_fseek.c"),
|
||||
Object(NonMatching, "fa/pf_fsetclstlink.c"),
|
||||
Object(NonMatching, "fa/pf_fsexec.c"),
|
||||
Object(NonMatching, "fa/pf_fsfirst.c"),
|
||||
Object(NonMatching, "fa/pf_fsnext.c"),
|
||||
Object(NonMatching, "fa/pf_fstat.c"),
|
||||
Object(Matching, "fa/pf_fsync.c"),
|
||||
Object(Matching, "fa/pf_fwrite.c"),
|
||||
Object(Matching, "fa/pf_getdev.c"),
|
||||
Object(Matching, "fa/pf_getvol.c"),
|
||||
Object(Matching, "fa/pf_getvolcfg.c"),
|
||||
Object(Matching, "fa/pf_init_prfile2.c"),
|
||||
Object(Matching, "fa/pf_insert.c"),
|
||||
Object(Matching, "fa/pf_iswriteprotected.c"),
|
||||
Object(Matching, "fa/pf_mkdir.c"),
|
||||
Object(Matching, "fa/pf_mount.c"),
|
||||
Object(Matching, "fa/pf_move.c"),
|
||||
Object(Matching, "fa/pf_opendir.c"),
|
||||
Object(Matching, "fa/pf_readdir.c"),
|
||||
Object(Matching, "fa/pf_regctx.c"),
|
||||
Object(Matching, "fa/pf_remove.c"),
|
||||
Object(Matching, "fa/pf_rename.c"),
|
||||
Object(Matching, "fa/pf_rewinddir.c"),
|
||||
Object(Matching, "fa/pf_rmdir.c"),
|
||||
Object(Matching, "fa/pf_rmvvol.c"),
|
||||
Object(Matching, "fa/pf_seekdir.c"),
|
||||
Object(Matching, "fa/pf_setclstlink.c"),
|
||||
Object(Matching, "fa/pf_setcode.c"),
|
||||
Object(Matching, "fa/pf_setencode.c"),
|
||||
Object(Matching, "fa/pf_settailbuf.c"),
|
||||
Object(Matching, "fa/pf_setupfsi.c"),
|
||||
Object(Matching, "fa/pf_setvol.c"),
|
||||
Object(Matching, "fa/pf_setvolcfg.c"),
|
||||
Object(Matching, "fa/pf_sync.c"),
|
||||
Object(Matching, "fa/pf_telldir.c"),
|
||||
Object(Matching, "fa/pf_unmount.c"),
|
||||
Object(Matching, "fa/pf_unregctx.c"),
|
||||
Object(Matching, "fa/pf_xdivide.c"),
|
||||
Object(NonMatching, "fa/pf_getdev.c"),
|
||||
Object(NonMatching, "fa/pf_getvol.c"),
|
||||
Object(NonMatching, "fa/pf_getvolcfg.c"),
|
||||
Object(NonMatching, "fa/pf_init_prfile2.c"),
|
||||
Object(NonMatching, "fa/pf_insert.c"),
|
||||
Object(NonMatching, "fa/pf_iswriteprotected.c"),
|
||||
Object(NonMatching, "fa/pf_mkdir.c"),
|
||||
Object(NonMatching, "fa/pf_mount.c"),
|
||||
Object(NonMatching, "fa/pf_move.c"),
|
||||
Object(NonMatching, "fa/pf_opendir.c"),
|
||||
Object(NonMatching, "fa/pf_readdir.c"),
|
||||
Object(NonMatching, "fa/pf_regctx.c"),
|
||||
Object(NonMatching, "fa/pf_remove.c"),
|
||||
Object(NonMatching, "fa/pf_rename.c"),
|
||||
Object(NonMatching, "fa/pf_rewinddir.c"),
|
||||
Object(NonMatching, "fa/pf_rmdir.c"),
|
||||
Object(NonMatching, "fa/pf_rmvvol.c"),
|
||||
Object(NonMatching, "fa/pf_seekdir.c"),
|
||||
Object(NonMatching, "fa/pf_setclstlink.c"),
|
||||
Object(NonMatching, "fa/pf_setcode.c"),
|
||||
Object(NonMatching, "fa/pf_setencode.c"),
|
||||
Object(NonMatching, "fa/pf_settailbuf.c"),
|
||||
Object(NonMatching, "fa/pf_setupfsi.c"),
|
||||
Object(NonMatching, "fa/pf_setvol.c"),
|
||||
Object(NonMatching, "fa/pf_setvolcfg.c"),
|
||||
Object(NonMatching, "fa/pf_sync.c"),
|
||||
Object(NonMatching, "fa/pf_telldir.c"),
|
||||
Object(NonMatching, "fa/pf_unmount.c"),
|
||||
Object(NonMatching, "fa/pf_unregctx.c"),
|
||||
Object(NonMatching, "fa/pf_xdivide.c"),
|
||||
Object(Matching, "fa/pf_w_api_util.c"),
|
||||
Object(Matching, "fa/pf_w_cdelete.c"),
|
||||
Object(Matching, "fa/pf_w_chdir.c"),
|
||||
Object(Matching, "fa/pf_w_chdmod.c"),
|
||||
Object(Matching, "fa/pf_w_chmod.c"),
|
||||
Object(Matching, "fa/pf_w_cinsert.c"),
|
||||
Object(Matching, "fa/pf_w_combine.c"),
|
||||
Object(Matching, "fa/pf_w_create.c"),
|
||||
Object(Matching, "fa/pf_w_createdir.c"),
|
||||
Object(Matching, "fa/pf_w_cut.c"),
|
||||
Object(Matching, "fa/pf_w_divide.c"),
|
||||
Object(Matching, "fa/pf_w_fconcat.c"),
|
||||
Object(Matching, "fa/pf_w_fopen.c"),
|
||||
Object(Matching, "fa/pf_w_fsexec.c"),
|
||||
Object(Matching, "fa/pf_w_fsfirst.c"),
|
||||
Object(Matching, "fa/pf_w_fsnext.c"),
|
||||
Object(Matching, "fa/pf_w_fstat.c"),
|
||||
Object(Matching, "fa/pf_w_insert.c"),
|
||||
Object(Matching, "fa/pf_w_mkdir.c"),
|
||||
Object(Matching, "fa/pf_w_move.c"),
|
||||
Object(Matching, "fa/pf_w_opendir.c"),
|
||||
Object(Matching, "fa/pf_w_remove.c"),
|
||||
Object(Matching, "fa/pf_w_rename.c"),
|
||||
Object(Matching, "fa/pf_w_rmdir.c"),
|
||||
Object(Matching, "fa/pf_w_xdivide.c"),
|
||||
Object(Matching, "fa/pf_filelock.c"),
|
||||
Object(Matching, "fa/pf_stub.c"),
|
||||
Object(Matching, "fa/pf_system.c"),
|
||||
Object(Matching, "fa/pf_stub_standard.c"),
|
||||
Object(Matching, "fa/pfs_attach.c"),
|
||||
Object(Matching, "fa/pfs_buffering.c"),
|
||||
Object(Matching, "fa/pfs_create.c"),
|
||||
Object(Matching, "fa/pfs_createdir.c"),
|
||||
Object(Matching, "fa/pfs_detach.c"),
|
||||
Object(Matching, "fa/pfs_errnum.c"),
|
||||
Object(Matching, "fa/pfs_fclose.c"),
|
||||
Object(Matching, "fa/pfs_finfot.c"),
|
||||
Object(Matching, "fa/pfs_fopen.c"),
|
||||
Object(Matching, "fa/pfs_format.c"),
|
||||
Object(Matching, "fa/pfs_fread.c"),
|
||||
Object(Matching, "fa/pfs_fseek.c"),
|
||||
Object(Matching, "fa/pfs_fsfirst.c"),
|
||||
Object(Matching, "fa/pfs_fsnext.c"),
|
||||
Object(Matching, "fa/pfs_fstat.c"),
|
||||
Object(Matching, "fa/pfs_fwrite.c"),
|
||||
Object(Matching, "fa/pfs_getdev.c"),
|
||||
Object(Matching, "fa/pfs_init_prfile2.c"),
|
||||
Object(Matching, "fa/pfs_mount.c"),
|
||||
Object(Matching, "fa/pfs_remove.c"),
|
||||
Object(Matching, "fa/pfs_unmount.c"),
|
||||
Object(Matching, "fa/pf_stub_unicode.c"),
|
||||
Object(NonMatching, "fa/pf_w_cdelete.c"),
|
||||
Object(NonMatching, "fa/pf_w_chdir.c"),
|
||||
Object(NonMatching, "fa/pf_w_chdmod.c"),
|
||||
Object(NonMatching, "fa/pf_w_chmod.c"),
|
||||
Object(NonMatching, "fa/pf_w_cinsert.c"),
|
||||
Object(NonMatching, "fa/pf_w_combine.c"),
|
||||
Object(NonMatching, "fa/pf_w_create.c"),
|
||||
Object(NonMatching, "fa/pf_w_createdir.c"),
|
||||
Object(NonMatching, "fa/pf_w_cut.c"),
|
||||
Object(NonMatching, "fa/pf_w_divide.c"),
|
||||
Object(NonMatching, "fa/pf_w_fconcat.c"),
|
||||
Object(NonMatching, "fa/pf_w_fopen.c"),
|
||||
Object(NonMatching, "fa/pf_w_fsexec.c"),
|
||||
Object(NonMatching, "fa/pf_w_fsfirst.c"),
|
||||
Object(NonMatching, "fa/pf_w_fsnext.c"),
|
||||
Object(NonMatching, "fa/pf_w_fstat.c"),
|
||||
Object(NonMatching, "fa/pf_w_insert.c"),
|
||||
Object(NonMatching, "fa/pf_w_mkdir.c"),
|
||||
Object(NonMatching, "fa/pf_w_move.c"),
|
||||
Object(NonMatching, "fa/pf_w_opendir.c"),
|
||||
Object(NonMatching, "fa/pf_w_remove.c"),
|
||||
Object(NonMatching, "fa/pf_w_rename.c"),
|
||||
Object(NonMatching, "fa/pf_w_rmdir.c"),
|
||||
Object(NonMatching, "fa/pf_w_xdivide.c"),
|
||||
Object(NonMatching, "fa/pf_filelock.c"),
|
||||
Object(NonMatching, "fa/pf_stub.c"),
|
||||
Object(NonMatching, "fa/pf_system.c"),
|
||||
Object(NonMatching, "fa/pf_stub_standard.c"),
|
||||
Object(NonMatching, "fa/pfs_attach.c"),
|
||||
Object(NonMatching, "fa/pfs_buffering.c"),
|
||||
Object(NonMatching, "fa/pfs_create.c"),
|
||||
Object(NonMatching, "fa/pfs_createdir.c"),
|
||||
Object(NonMatching, "fa/pfs_detach.c"),
|
||||
Object(NonMatching, "fa/pfs_errnum.c"),
|
||||
Object(NonMatching, "fa/pfs_fclose.c"),
|
||||
Object(NonMatching, "fa/pfs_finfot.c"),
|
||||
Object(NonMatching, "fa/pfs_fopen.c"),
|
||||
Object(NonMatching, "fa/pfs_format.c"),
|
||||
Object(NonMatching, "fa/pfs_fread.c"),
|
||||
Object(NonMatching, "fa/pfs_fseek.c"),
|
||||
Object(NonMatching, "fa/pfs_fsfirst.c"),
|
||||
Object(NonMatching, "fa/pfs_fsnext.c"),
|
||||
Object(NonMatching, "fa/pfs_fstat.c"),
|
||||
Object(NonMatching, "fa/pfs_fwrite.c"),
|
||||
Object(NonMatching, "fa/pfs_getdev.c"),
|
||||
Object(NonMatching, "fa/pfs_init_prfile2.c"),
|
||||
Object(NonMatching, "fa/pfs_mount.c"),
|
||||
Object(NonMatching, "fa/pfs_remove.c"),
|
||||
Object(NonMatching, "fa/pfs_unmount.c"),
|
||||
Object(NonMatching, "fa/pf_stub_unicode.c"),
|
||||
|
||||
Object(NonMatching, "fa/api/FAAttach.c"),
|
||||
Object(Matching, "fa/api/FABuffering.c"),
|
||||
Object(Matching, "fa/api/FACreate.c"),
|
||||
Object(Matching, "fa/api/FACreatedir.c"),
|
||||
Object(Matching, "fa/api/FADetach.c"),
|
||||
Object(Matching, "fa/api/FAErrnum.c"),
|
||||
Object(NonMatching, "fa/api/FABuffering.c"),
|
||||
Object(NonMatching, "fa/api/FACreate.c"),
|
||||
Object(NonMatching, "fa/api/FACreatedir.c"),
|
||||
Object(NonMatching, "fa/api/FADetach.c"),
|
||||
Object(NonMatching, "fa/api/FAErrnum.c"),
|
||||
Object(Matching, "fa/api/FAFclose.c"),
|
||||
Object(Matching, "fa/api/FAFinfo.c"),
|
||||
Object(Matching, "fa/api/FAFopen.c"),
|
||||
Object(Matching, "fa/api/FAFormat.c"),
|
||||
Object(NonMatching, "fa/api/FAFopen.c"),
|
||||
Object(NonMatching, "fa/api/FAFormat.c"),
|
||||
Object(Matching, "fa/api/FAFread.c"),
|
||||
Object(Matching, "fa/api/FAFseek.c"),
|
||||
Object(Matching, "fa/api/FAFsfirst.c"),
|
||||
Object(Matching, "fa/api/FAFsnext.c"),
|
||||
Object(Matching, "fa/api/FAFstat.c"),
|
||||
Object(NonMatching, "fa/api/FAFseek.c"),
|
||||
Object(NonMatching, "fa/api/FAFsfirst.c"),
|
||||
Object(NonMatching, "fa/api/FAFsnext.c"),
|
||||
Object(NonMatching, "fa/api/FAFstat.c"),
|
||||
Object(Matching, "fa/api/FAFwrite.c"),
|
||||
Object(Matching, "fa/api/FAGetdev.c"),
|
||||
Object(Matching, "fa/api/FAInit.c"),
|
||||
Object(NonMatching, "fa/api/FAGetdev.c"),
|
||||
Object(NonMatching, "fa/api/FAInit.c"),
|
||||
Object(Matching, "fa/api/FAInitDiskManager.c"),
|
||||
Object(Matching, "fa/api/FAMount.c"),
|
||||
Object(Matching, "fa/api/FARegistCB.c"),
|
||||
Object(Matching, "fa/api/FARemove.c"),
|
||||
Object(Matching, "fa/api/FASetThreadPriority.c"),
|
||||
Object(Matching, "fa/api/FAUnmount.c"),
|
||||
Object(NonMatching, "fa/api/FAMount.c"),
|
||||
Object(NonMatching, "fa/api/FARegistCB.c"),
|
||||
Object(NonMatching, "fa/api/FARemove.c"),
|
||||
Object(NonMatching, "fa/api/FASetThreadPriority.c"),
|
||||
Object(NonMatching, "fa/api/FAUnmount.c"),
|
||||
|
||||
Object(Matching, "fa/kernel/pfk_api.c"),
|
||||
Object(NonMatching, "fa/kernel/pfk_api.c"),
|
||||
|
||||
Object(Matching, "fa/driver/nand_drv.c"),
|
||||
Object(NonMatching, "fa/driver/nand_drv.c"),
|
||||
Object(NonMatching, "fa/driver/sd_drv.c"),
|
||||
Object(Matching, "fa/driver/pfd_cmn.c"),
|
||||
Object(Matching, "fa/driver/msc_drv.c"),
|
||||
Object(NonMatching, "fa/driver/pfd_cmn.c"),
|
||||
Object(NonMatching, "fa/driver/msc_drv.c"),
|
||||
|
||||
Object(Matching, "fa/msc/puh_msc.c"),
|
||||
Object(Matching, "fa/msc/puh_msc_cmd.c"),
|
||||
Object(NonMatching, "fa/msc/puh_msc.c"),
|
||||
Object(NonMatching, "fa/msc/puh_msc_cmd.c"),
|
||||
Object(NonMatching, "fa/msc/puh_msc_blk.c"),
|
||||
]
|
||||
),
|
||||
@@ -1870,7 +1870,7 @@ config.libs = [
|
||||
RVLSDKLib("nup", [
|
||||
Object(NonMatching, "nup/nup.cpp"),
|
||||
Object(NonMatching, "nup/nup_nhttp.cpp"),
|
||||
Object(Matching, "nup/nup_mem.cpp"),
|
||||
Object(NonMatching, "nup/nup_mem.cpp"),
|
||||
]
|
||||
),
|
||||
RVLSDKLib("scutil", [
|
||||
@@ -1887,7 +1887,7 @@ config.libs = [
|
||||
RVLSDKLib("kbd", [
|
||||
Object(NonMatching, "kbd/kbd_lib.c"),
|
||||
Object(NonMatching, "kbd/kbd_lib_map_jp.c"),
|
||||
Object(Matching, "kbd/kbd_lib_map_us.c"),
|
||||
Object(NonMatching, "kbd/kbd_lib_map_us.c"),
|
||||
Object(NonMatching, "kbd/kbd_lib_map_eu.c"),
|
||||
]
|
||||
),
|
||||
@@ -1944,33 +1944,33 @@ config.libs = [
|
||||
Object(Matching, "MSL_Common/alloc.c"),
|
||||
Object(Matching, "MSL_Common/errno.c"),
|
||||
Object(Matching, "MSL_Common/ansi_files.c"),
|
||||
Object(Matching, "MSL_Common_Embedded/ansi_fp.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(NonMatching, "MSL_Common_Embedded/ansi_fp.c"),
|
||||
Object(Matching, "MSL_Common/ctype.c"),
|
||||
Object(Matching, "MSL_Common/locale.c"),
|
||||
Object(NonMatching, "MSL_Common/locale.c"),
|
||||
Object(Matching, "MSL_Common/arith.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/bsearch.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/buffer_io.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/direct_io.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/file_io.c"),
|
||||
Object(NonMatching, "MSL_Common/file_io.c"),
|
||||
Object(Matching, "MSL_Common/FILE_POS.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/mbstring.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/mem.c"),
|
||||
Object(Matching, "MSL_Common/mem_funcs.c"),
|
||||
Object(Matching, "MSL_Common/math_api.c"),
|
||||
Object(Matching, "MSL_Common/misc_io.c"),
|
||||
Object(Matching, "MSL_Common/printf.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(NonMatching, "MSL_Common/printf.c"),
|
||||
Object(Matching, "MSL_Common/qsort.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/rand.c"),
|
||||
Object(Matching, "MSL_Common/scanf.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(NonMatching, "MSL_Common/scanf.c"),
|
||||
Object(Matching, "MSL_Common/signal.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/string.c"),
|
||||
Object(Matching, "MSL_Common/float.c"),
|
||||
Object(Matching, "MSL_Common/strtold.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(NonMatching, "MSL_Common/strtold.c"),
|
||||
Object(Matching, "MSL_Common/strtoul.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/time.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(NonMatching, "MSL_Common/time.c"),
|
||||
Object(Matching, "MSL_Common/wctype.c"),
|
||||
Object(Matching, "MSL_Common/wmem.c"),
|
||||
Object(NonMatching, "MSL_Common/wprintf.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(NonMatching, "MSL_Common/wprintf.c"),
|
||||
Object(Matching, "MSL_Common/wstring.c"),
|
||||
Object(Matching, "MSL_Common/wchar_io.c"),
|
||||
Object(Matching, "PPC_EABI/time.dolphin.c"),
|
||||
|
||||
@@ -14,12 +14,7 @@ enum {
|
||||
typedef struct BS2UpdateHeader {
|
||||
char timestamp[16]; // 0x00
|
||||
u32 wadCount; // 0x10
|
||||
#ifdef BS2_UPDATE_SOURCE
|
||||
u32 extraCount;
|
||||
u32 reserved[2];
|
||||
#else
|
||||
u32 reserved[3]; // 0x14
|
||||
#endif
|
||||
} BS2UpdateHeader;
|
||||
|
||||
typedef struct BS2UpdateEntry {
|
||||
@@ -34,12 +29,7 @@ typedef struct BS2UpdateEntry {
|
||||
u64 titleId; // 0x50
|
||||
u16 titleVersion; // 0x58
|
||||
|
||||
#ifdef BS2_UPDATE_SOURCE
|
||||
u16 reservedTitle;
|
||||
u32 inodes;
|
||||
#else
|
||||
u8 padding[6]; // 0x5A
|
||||
#endif
|
||||
|
||||
// Update Data
|
||||
char dataName[0x40]; // 0x60
|
||||
|
||||
@@ -96,7 +96,7 @@ CHANSVmNativeClass* CHANSVmAddNativeClass(CHANSVm* vm, const char* clsName, CHAN
|
||||
/*** CHANS Image ***/
|
||||
/************************/
|
||||
|
||||
typedef vmBoolInt (*CHANSVmImageCtorCallback)(CHANSVm* vm, vmPtr data);
|
||||
typedef vmBoolInt (*CHANSVmImageCtorCallback)(CHANSVm* vm);
|
||||
typedef vmPtr (*CHANSVmImageAllocatorCallback)(CHANSVm* vm, u32 size);
|
||||
|
||||
void CHANSVmImageRegisterAllocator(CHANSVmImageAllocatorCallback allocCb, CHANSVmImageCtorCallback ctorCb);
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace homebutton {
|
||||
|
||||
private:
|
||||
static bool sBatteryFlag[WPAD_MAX_CONTROLLERS];
|
||||
static bool sAlarmCreated[WPAD_MAX_CONTROLLERS];
|
||||
static bool lbl_816989BC[WPAD_MAX_CONTROLLERS];
|
||||
|
||||
static OSAlarm sAlarm[WPAD_MAX_CONTROLLERS];
|
||||
static OSAlarm sAlarmSoundOff[WPAD_MAX_CONTROLLERS];
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace ext_ead {
|
||||
|
||||
class SurfaceManager {
|
||||
public:
|
||||
static void CreateManager(int surfaceW, int surfaceH, int browserW, int browserH, void* mem1Buf, u32 mem1BufSize, void* mem2Buf, u32 mem2BufSize,
|
||||
void* libBuf, const char* arcPath);
|
||||
static void CreateManager(int rectW0, int rectH0, int rectW1, int rectH1, void* mem1Buf, u32 mem1BufSize, void* mem2Buf, u32 mem2BufSize,
|
||||
void* libBuf, const char* param_10);
|
||||
static void DisposeManager();
|
||||
|
||||
static void RegisterArcFile(void* fileBuf);
|
||||
|
||||
@@ -18,9 +18,7 @@ namespace textinput {
|
||||
LayoutByNW4R(nw4r::lyt::MultiArcResourceAccessor* multiArc, const char* layoutName, EventObserver* event)
|
||||
: nw4rmanager::Layout(multiArc, layoutName, event) {}
|
||||
#endif
|
||||
#if defined(MYTIMANAGER_MATCHING)
|
||||
virtual ~LayoutByNW4R() {}
|
||||
#elif defined(MYTIMANAGER_IMPLEMENTATION)
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
virtual ~LayoutByNW4R();
|
||||
#else
|
||||
virtual ~LayoutByNW4R() {}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace textinput {
|
||||
virtual void moveNigaoeButton() {}
|
||||
};
|
||||
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#ifdef MYTIINPUTFORM_IMPLEMENTATION
|
||||
class ScrollButton;
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace textinput {
|
||||
#endif
|
||||
|
||||
~InputForm();
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#ifdef MYTIINPUTFORM_IMPLEMENTATION
|
||||
virtual void moveCursorUp();
|
||||
virtual void moveCursorDown();
|
||||
virtual void onCommand(INPUT_COMMAND command, void* data);
|
||||
@@ -131,7 +131,7 @@ namespace textinput {
|
||||
void setEditScrollDown(bool editScrollDown) { mbEditScrollUp = editScrollDown; }
|
||||
void setCloseWithSend(bool closeWithSend) { mbCloseWithSend = closeWithSend; }
|
||||
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION)
|
||||
void setEditMode(EditMode editMode);
|
||||
#else
|
||||
void setEditMode(EditMode editMode) { meEditMode = editMode; }
|
||||
@@ -147,12 +147,8 @@ namespace textinput {
|
||||
|
||||
tistring::Decolated* getSendString() { return mpSendString; }
|
||||
|
||||
#ifdef MYTILETTERFORM_IMPLEMENTATION
|
||||
protected:
|
||||
#else
|
||||
private:
|
||||
#endif
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#ifdef MYTIINPUTFORM_IMPLEMENTATION
|
||||
nw4r::lyt::Pane* mpMemoPane;
|
||||
nw4r::lyt::Pane* mpMemoRootPane;
|
||||
nw4r::lyt::Pane* mpBoundPane;
|
||||
@@ -176,7 +172,7 @@ namespace textinput {
|
||||
nw4r::lyt::Size mDefaultBoundSize; // 0x358
|
||||
Mtx mDrawMtx; // 0x360
|
||||
Mtx mBoundMtx; // 0x390
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION)
|
||||
util::Animation mExScrollAnm; // 0x3C0
|
||||
#else
|
||||
u8 /*todo*/ mExScrollAnm[32]; // 0x3C0
|
||||
@@ -190,7 +186,7 @@ namespace textinput {
|
||||
bool mbEditScrollDown; // 0x3EF
|
||||
bool mbCloseWithSend; // 0x3F0
|
||||
u8 padding[3]; // 0x3F1
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#ifdef MYTIINPUTFORM_IMPLEMENTATION
|
||||
ScrollButton* mpScrollButton;
|
||||
#else
|
||||
undefined4* mpScrollButton;
|
||||
|
||||
@@ -23,15 +23,6 @@ namespace textinput {
|
||||
unk_0x400(0), mbPhotoDraw(false), meType(T_MailAddressSel) {}
|
||||
#endif
|
||||
|
||||
#ifdef MYTILETTERFORM_IMPLEMENTATION
|
||||
virtual ~InputForm();
|
||||
virtual void create(MEMAllocator*, inputform::EditBuffer*);
|
||||
virtual void drawBody();
|
||||
virtual void drawFooter();
|
||||
virtual void open();
|
||||
virtual void close();
|
||||
virtual bool isWholePaneInAnimation();
|
||||
#endif
|
||||
virtual nw4r::lyt::Material* getPhotoPaneMaterial();
|
||||
|
||||
virtual void onPhotoTrig();
|
||||
@@ -47,11 +38,7 @@ namespace textinput {
|
||||
void resizePhotoPane(f32 width, f32 height);
|
||||
|
||||
private:
|
||||
#ifdef MYTILETTERFORM_IMPLEMENTATION
|
||||
bool mbPhotoScaledUp;
|
||||
#else
|
||||
u8 unk_0x400;
|
||||
#endif
|
||||
bool mbPhotoDraw; // 0x401
|
||||
Type meType; // 0x404
|
||||
};
|
||||
|
||||
@@ -167,25 +167,6 @@ namespace textinput {
|
||||
void setManager(Manager* manager) { mpManager = manager; }
|
||||
#endif
|
||||
virtual ~State();
|
||||
#ifdef MYTIMANAGER_MATCHING
|
||||
virtual Manager::StateType getStateType() = 0;
|
||||
|
||||
virtual void create() = 0;
|
||||
|
||||
virtual void init() = 0;
|
||||
|
||||
virtual void draw() = 0;
|
||||
virtual void memoDraw() = 0;
|
||||
|
||||
virtual void calc() = 0;
|
||||
|
||||
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release) = 0;
|
||||
virtual bool updateInput(input::HKBManager& hkbManager) = 0;
|
||||
|
||||
virtual void start() = 0;
|
||||
virtual void end() = 0;
|
||||
|
||||
#else
|
||||
virtual Manager::StateType getStateType();
|
||||
|
||||
virtual void create();
|
||||
@@ -203,7 +184,6 @@ namespace textinput {
|
||||
virtual void start();
|
||||
virtual void end();
|
||||
|
||||
#endif
|
||||
#ifdef MYTIMANAGER_IMPLEMENTATION
|
||||
virtual InputForm* InputForm();
|
||||
virtual keyboard::hwkey::HWKeyboard* HWKeyboard();
|
||||
|
||||
@@ -187,19 +187,7 @@ namespace textinput {
|
||||
void SetFocusedText(s32 pane) { mnFocusedIdx = pane; }
|
||||
s32 GetFocusedText() { return mnFocusedIdx; }
|
||||
f32 GetWidthScale_() const { return 608.0f / mfScreenWidth; }
|
||||
#ifdef TI_CANDIDATEBOX_IMPLEMENTATION
|
||||
f32 GetMargin_() const {
|
||||
f32 margin;
|
||||
if (mfScreenWidth > 700.0f) {
|
||||
margin = 10.0f;
|
||||
} else {
|
||||
margin = 20.0f;
|
||||
}
|
||||
return margin;
|
||||
}
|
||||
#else
|
||||
f32 GetMargin_() const { return mfScreenWidth > 700.0f ? 10.0f : 20.0f; }
|
||||
#endif
|
||||
s32 GetNextPageIdx_(s32 page) const;
|
||||
s32 GetPrevPageIdx_(s32 page) const;
|
||||
s32 GetDispNum() const;
|
||||
|
||||
@@ -2,58 +2,20 @@
|
||||
#define TEXTINPUT_CELL_PHONE_H
|
||||
|
||||
#include "tiNw4rManager.h"
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#include "tiKeyboard.h"
|
||||
#endif
|
||||
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
#include <revolution/gx.h>
|
||||
#endif
|
||||
|
||||
namespace textinput {
|
||||
class Manager;
|
||||
#ifdef TI_CELLPHONE_SAMPLE_CLASS
|
||||
class EventObserver;
|
||||
#endif
|
||||
namespace predictlang {
|
||||
class LayoutByNW4R;
|
||||
}
|
||||
namespace keyboard {
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
enum VKeyCode {
|
||||
VK_LINE_FEED = 0,
|
||||
VK_DELETE = 1,
|
||||
VK_SIGN_INPUT = 9,
|
||||
VK_PREDICT_LANGUAGE = 10,
|
||||
VK_INPUT_MODE_02 = 11,
|
||||
VK_INPUT_MODE_03 = 13,
|
||||
VK_INPUT_MODE_00 = 18,
|
||||
VK_INPUT_MODE_01 = 19,
|
||||
VK_TOGGLE_ABC_MODE = 23,
|
||||
};
|
||||
#endif
|
||||
namespace signwindow {
|
||||
class LayoutByNW4R;
|
||||
}
|
||||
}
|
||||
|
||||
namespace keyboard {
|
||||
namespace cellphonetype {
|
||||
class EventHandler;
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
class CellPhoneAnmPane;
|
||||
struct PaneNameToCharCode;
|
||||
#endif
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
class Base : public textinput::keyboard::KeyboardBase {
|
||||
#else
|
||||
class Base {
|
||||
#endif
|
||||
public:
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) && defined(TI_CELLPHONE_SAMPLE_CLASS)
|
||||
Base(Manager* manager) : mPreviousInputMode(0), mCurrentInputMode(0), mpManager(manager) {}
|
||||
#endif
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
enum InputMode {
|
||||
IM_00,
|
||||
IM_01,
|
||||
@@ -69,12 +31,6 @@ namespace textinput {
|
||||
virtual void onKey(u32, void*) override;
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
Base(Manager* manager) : mpManager(manager) {}
|
||||
#endif
|
||||
#if defined(TI_CELLPHONE_IMPLEMENTATION)
|
||||
virtual u32 getType() override;
|
||||
#elif defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual int getType() override;
|
||||
#elif defined(TIHWKEYBOARD_IMPLEMENTATION)
|
||||
virtual int getType() override;
|
||||
#else
|
||||
virtual void getType() override;
|
||||
@@ -101,9 +57,6 @@ namespace textinput {
|
||||
virtual bool isAtokActive();
|
||||
virtual void doInput();
|
||||
virtual void updateFixMode();
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
wchar_t convertToZiCellphoneInput_(wchar_t value);
|
||||
#endif
|
||||
#else
|
||||
virtual void vt_0x08();
|
||||
virtual void vt_0x0C();
|
||||
@@ -126,7 +79,7 @@ namespace textinput {
|
||||
|
||||
virtual void vt_0x4C();
|
||||
virtual void vt_0x50();
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual void doNumericMode(bool);
|
||||
#else
|
||||
virtual void vt_0x54();
|
||||
@@ -142,16 +95,12 @@ namespace textinput {
|
||||
|
||||
// TODO enum?
|
||||
int getInputType() const;
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
void resetHoldingButton();
|
||||
#endif
|
||||
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) && defined(TI_CELLPHONE_IMPLEMENTATION)
|
||||
protected:
|
||||
#else
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
private:
|
||||
#endif
|
||||
u32 mPreviousInputMode;
|
||||
u32 mCurrentInputMode;
|
||||
bool mbInputModeLocked;
|
||||
@@ -160,116 +109,87 @@ namespace textinput {
|
||||
bool mbUpperCaseMode;
|
||||
bool mbAbcMode;
|
||||
bool mbLanguageKeyMode;
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
const PaneNameToCharCode* mHoldingButton;
|
||||
#else
|
||||
u32 mHoldingButton;
|
||||
#endif
|
||||
void* mpInputModeTable;
|
||||
MEMAllocator* mpAllocator;
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
Manager* mpManager;
|
||||
bool mInputState;
|
||||
#elif defined(TIMANAGER_IMPLEMENTATION)
|
||||
Manager* mpManager;
|
||||
u32 mInputState;
|
||||
#else
|
||||
void* mpInputSettings;
|
||||
#endif
|
||||
u32 mInputState;
|
||||
#endif
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
void onCtrlKey_(VKeyCode keyCode);
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef TI_CELLPHONE_MATCH_LAYOUT
|
||||
#include "tiCellPhoneLayout.h"
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
|
||||
public:
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: Base(manager), nw4rmanager::Layout(accessor, layoutName, observer), mpEventHandler(NULL) {}
|
||||
virtual ~LayoutByNW4R();
|
||||
virtual void create(MEMAllocator* allocator);
|
||||
virtual void init();
|
||||
virtual void setCommandReceiver(CommandReceiver* receiver);
|
||||
virtual void updateFromReceiver(u32 command, void* data);
|
||||
virtual void onKey(u32 event, void* data);
|
||||
virtual void setLanguage(Language language);
|
||||
virtual void update();
|
||||
virtual void onActive();
|
||||
virtual void calc();
|
||||
virtual void draw();
|
||||
virtual void changeInputMode(InputMode mode);
|
||||
virtual void setInputMode(InputMode mode);
|
||||
virtual void setUpperCaseJP(bool upper);
|
||||
virtual void setLangKeyActive(bool active);
|
||||
virtual void goSignInputMode();
|
||||
virtual void changePredictLanguage();
|
||||
virtual void setAbcMode(bool abc);
|
||||
virtual void doNumericMode(bool);
|
||||
virtual void setPredictLanguageDialog(predictlang::LayoutByNW4R* dialog);
|
||||
virtual void setSignWindow(signwindow::LayoutByNW4R* window);
|
||||
#else
|
||||
class LayoutByNW4R;
|
||||
virtual void doNumericMode(bool);
|
||||
virtual void setPredictLanguageDialog(void*);
|
||||
virtual void setSignWindow(void*);
|
||||
#endif
|
||||
virtual void doNumericWithDotMode(bool);
|
||||
virtual void setLineFeedButton(bool);
|
||||
virtual void setPredictLanguageButton(bool);
|
||||
virtual void setSignWindowButton(bool);
|
||||
#endif
|
||||
virtual bool onClose();
|
||||
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
enum Animation {
|
||||
ANM_Normal,
|
||||
ANM_FocusIn,
|
||||
ANM_FocusOut,
|
||||
ANM_RollOver,
|
||||
ANM_Pushed,
|
||||
ANM_05,
|
||||
ANM_06,
|
||||
ANM_ToggleOff,
|
||||
ANM_Last,
|
||||
};
|
||||
|
||||
enum KeyType {
|
||||
KT_NormalButton,
|
||||
KT_ControlButton,
|
||||
};
|
||||
|
||||
#ifdef TI_CELLPHONE_MATCH_LAYOUT
|
||||
class EventHandler : public nw4rmanager::TiEventHandler {
|
||||
public:
|
||||
EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
|
||||
virtual ~EventHandler();
|
||||
virtual void onTiEvent(gui::PaneComponent* pane, u32 event, Input* input) override;
|
||||
|
||||
void onPressedShift(bool shift);
|
||||
void onReleasedShift();
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
bool hasLineFeedButton() const { return mbLineFeedButton; }
|
||||
private:
|
||||
LayoutByNW4R* mpLayoutByNW4R;
|
||||
};
|
||||
bool mbLineFeedButton;
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
GXTexObj mSpaceTexture;
|
||||
GXTexObj mSpaceTextureCN;
|
||||
GXTexObj mSpaceTextureKR;
|
||||
nw4rmanager::TiEventHandler* mpEventHandler;
|
||||
predictlang::LayoutByNW4R* mpPredictDialog;
|
||||
signwindow::LayoutByNW4R* mpSignWindow;
|
||||
#endif
|
||||
|
||||
class CellPhoneAnmPane : public nw4rmanager::AnmPane {
|
||||
public:
|
||||
CellPhoneAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
#ifdef TI_CELLPHONE_MATCH_LAYOUT
|
||||
: nw4rmanager::AnmPane(pane, observer), meState(ANM_Normal), meKeyType(KT_NormalButton) {
|
||||
init();
|
||||
changeAnimation(meState);
|
||||
}
|
||||
#else
|
||||
: nw4rmanager::AnmPane(pane, observer), meState(ANM_Normal), meKeyType(KT_NormalButton) {}
|
||||
#endif
|
||||
|
||||
virtual void init() override;
|
||||
virtual void onAnmEvent(AnmPaneEvent event) override;
|
||||
virtual void changeAnimation(u32 id) override;
|
||||
virtual KeyType getKeyType() const;
|
||||
u32 getAnimationState() const { return meState; }
|
||||
virtual ~CellPhoneAnmPane();
|
||||
|
||||
protected:
|
||||
Animation meState;
|
||||
KeyType meKeyType;
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) override;
|
||||
virtual bool updateInput(input::HKBManager& hkbManager) override;
|
||||
#endif
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
virtual nw4rmanager::AnmPane* getAnmPane(InputMode mode);
|
||||
virtual void throwReleaseForAll();
|
||||
virtual void changeAnimationAllToNormal();
|
||||
virtual void updatePredictLanguage(CommandReceiver::ChangePredictMode* mode);
|
||||
virtual void changeKeyTop(const struct PaneNameToCharCode* table);
|
||||
virtual void changeSpaceKeyTop(const struct PaneNameToCharCode* table);
|
||||
#endif
|
||||
};
|
||||
|
||||
class CellPhoneControlAnmPane : public CellPhoneAnmPane {
|
||||
public:
|
||||
CellPhoneControlAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
: CellPhoneAnmPane(pane, observer) { meKeyType = KT_ControlButton; }
|
||||
|
||||
virtual void onAnmEvent(AnmPaneEvent event) override;
|
||||
virtual ~CellPhoneControlAnmPane();
|
||||
};
|
||||
|
||||
#ifndef TI_CELLPHONE_MATCH_LAYOUT
|
||||
class EventHandler : public nw4rmanager::TiEventHandler {
|
||||
public:
|
||||
EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
|
||||
virtual ~EventHandler();
|
||||
virtual void onTiEvent(gui::PaneComponent* pane, u32 event, Input* input) override;
|
||||
|
||||
private:
|
||||
LayoutByNW4R* mpLayoutByNW4R;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TI_CELLPHONE_MATCH_LAYOUT
|
||||
#include "tiCellPhoneLayout.h"
|
||||
#endif
|
||||
|
||||
} // namespace cellphonetype
|
||||
} // namespace keyboard
|
||||
} // namespace textinput
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
#ifndef TEXTINPUT_CELL_PHONE_LAYOUT_H
|
||||
#define TEXTINPUT_CELL_PHONE_LAYOUT_H
|
||||
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
|
||||
public:
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: Base(manager), nw4rmanager::Layout(accessor, layoutName, observer), mpEventHandler(NULL) {}
|
||||
virtual ~LayoutByNW4R();
|
||||
virtual void create(MEMAllocator* allocator);
|
||||
virtual void init();
|
||||
virtual void setCommandReceiver(CommandReceiver* receiver);
|
||||
virtual void updateFromReceiver(u32 command, void* data);
|
||||
virtual void onKey(u32 event, void* data);
|
||||
virtual void setLanguage(Language language);
|
||||
virtual void update();
|
||||
virtual void onActive();
|
||||
virtual void calc();
|
||||
virtual void draw();
|
||||
virtual void changeInputMode(InputMode mode);
|
||||
virtual void setInputMode(InputMode mode);
|
||||
virtual void setUpperCaseJP(bool upper);
|
||||
virtual void setLangKeyActive(bool active);
|
||||
virtual void goSignInputMode();
|
||||
virtual void changePredictLanguage();
|
||||
virtual void setAbcMode(bool abc);
|
||||
virtual void doNumericMode(bool);
|
||||
virtual void setPredictLanguageDialog(predictlang::LayoutByNW4R* dialog);
|
||||
virtual void setSignWindow(signwindow::LayoutByNW4R* window);
|
||||
#else
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) && defined(TI_CELLPHONE_SAMPLE_CLASS)
|
||||
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer)
|
||||
: Base(manager), nw4rmanager::Layout(resAccessor, "fs_VK_cellPhone_a.brlyt", observer), mpSignWindow(NULL) {}
|
||||
#endif
|
||||
virtual void doNumericMode(bool);
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
virtual void setPredictLanguageDialog(predictlang::LayoutByNW4R*);
|
||||
virtual void setSignWindow(signwindow::LayoutByNW4R*);
|
||||
#else
|
||||
virtual void setPredictLanguageDialog(void*);
|
||||
virtual void setSignWindow(void*);
|
||||
#endif
|
||||
#endif
|
||||
virtual void doNumericWithDotMode(bool);
|
||||
virtual void setLineFeedButton(bool);
|
||||
virtual void setPredictLanguageButton(bool);
|
||||
virtual void setSignWindowButton(bool);
|
||||
#endif
|
||||
virtual bool onClose();
|
||||
|
||||
void onPressedShift(bool shift);
|
||||
void onReleasedShift();
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
bool hasLineFeedButton() const { return mbLineFeedButton; }
|
||||
private:
|
||||
bool mbLineFeedButton;
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
GXTexObj mSpaceTexture;
|
||||
GXTexObj mSpaceTextureCN;
|
||||
GXTexObj mSpaceTextureKR;
|
||||
nw4rmanager::TiEventHandler* mpEventHandler;
|
||||
predictlang::LayoutByNW4R* mpPredictDialog;
|
||||
signwindow::LayoutByNW4R* mpSignWindow;
|
||||
#endif
|
||||
public:
|
||||
#endif
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) override;
|
||||
virtual bool updateInput(input::HKBManager& hkbManager) override;
|
||||
#endif
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
virtual ~LayoutByNW4R();
|
||||
virtual void create(MEMAllocator* allocator) override;
|
||||
virtual void init() override;
|
||||
virtual void draw() override;
|
||||
virtual void calc() override;
|
||||
virtual void update() override;
|
||||
virtual void onKey(u32 key, void* data) override;
|
||||
virtual void onActive() override;
|
||||
virtual void updateFromReceiver(u32 command, void* data) override;
|
||||
virtual void changeInputMode(InputMode mode) override;
|
||||
virtual void changePredictLanguage() override;
|
||||
virtual void setAbcMode(bool enabled) override;
|
||||
virtual void goSignInputMode() override;
|
||||
virtual void setInputMode(InputMode mode) override;
|
||||
virtual void setLanguage(Language language) override;
|
||||
virtual void setCommandReceiver(CommandReceiver* receiver) override;
|
||||
|
||||
virtual CellPhoneAnmPane* getAnmPane(InputMode mode);
|
||||
virtual void throwReleaseForAll();
|
||||
virtual void changeAnimationAllToNormal();
|
||||
virtual void updatePredictLanguage(CommandReceiver::ChangePredictMode* mode);
|
||||
virtual void changeKeyTop(const PaneNameToCharCode* keys);
|
||||
virtual void changeSpaceKeyTop(const PaneNameToCharCode* keys);
|
||||
void setUpperCaseJP(bool enabled);
|
||||
void setLangKeyActive(bool enabled);
|
||||
void resetHoldingButton();
|
||||
|
||||
private:
|
||||
bool mbLineFeedButton;
|
||||
GXTexObj mTextures[3];
|
||||
EventHandler* mpEventHandler;
|
||||
predictlang::LayoutByNW4R* mpPredictLanguageDialog;
|
||||
signwindow::LayoutByNW4R* mpSignWindow;
|
||||
#elif defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual nw4rmanager::AnmPane* getAnmPane(InputMode mode);
|
||||
virtual void throwReleaseForAll();
|
||||
virtual void changeAnimationAllToNormal();
|
||||
virtual void updatePredictLanguage(CommandReceiver::ChangePredictMode* mode);
|
||||
virtual void changeKeyTop(const struct PaneNameToCharCode* table);
|
||||
virtual void changeSpaceKeyTop(const struct PaneNameToCharCode* table);
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef TI_CELLPHONE_SAMPLE_CLASS
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer)
|
||||
: LayoutByNW4R(manager, resAccessor, observer) {}
|
||||
virtual ~Sample() {}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -93,13 +93,8 @@ namespace textinput {
|
||||
extern const KeySet csKeySetCNPinyin;
|
||||
extern const KeySet csKeySetHangul;
|
||||
|
||||
#ifdef TI_CELLPHONE_MATCH_LAYOUT
|
||||
extern const wchar_t* csSpaceZero;
|
||||
extern const wchar_t* csSpace;
|
||||
#else
|
||||
extern const wchar_t csSpaceZero[3];
|
||||
extern const wchar_t csSpace[3];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,138 +6,9 @@
|
||||
#include <revolution/mem/allocator.h>
|
||||
|
||||
#include "keyboard/tiCpData.h"
|
||||
#ifdef TIHKBMANAGER_IMPLEMENTATION
|
||||
#include <revolution/kbd.h>
|
||||
enum _KBDEc { KBD_EC_BUSY = 7 };
|
||||
#endif
|
||||
|
||||
namespace textinput {
|
||||
namespace input {
|
||||
#ifdef TIHKBMANAGER_IMPLEMENTATION
|
||||
class HKBManager {
|
||||
public:
|
||||
class KeyState_ {
|
||||
public:
|
||||
void NotifyEvent(u8 down, u8 code);
|
||||
void Update();
|
||||
void UpdateModState_();
|
||||
void Clear() {
|
||||
held = 0;
|
||||
triggered = 0;
|
||||
released = 0;
|
||||
repeated = 0;
|
||||
current = 0;
|
||||
pending = 0;
|
||||
modifiers &= 0x700;
|
||||
forceMask = 0;
|
||||
forceState = 0;
|
||||
retryLeds = 0;
|
||||
}
|
||||
void Initialize(u8 channel) {
|
||||
held = 0;
|
||||
triggered = 0;
|
||||
released = 0;
|
||||
repeated = 0;
|
||||
current = 0;
|
||||
pending = 0;
|
||||
forceMask = 0;
|
||||
forceState = 0;
|
||||
retryLeds = 0;
|
||||
device = channel;
|
||||
country = 0xf;
|
||||
modifiers = 0;
|
||||
}
|
||||
u8 device;
|
||||
u32 held, triggered, released, repeated;
|
||||
u32 previous, current, pending;
|
||||
u32 modifiers, forceState, forceMask;
|
||||
s32 country;
|
||||
u8 retryLeds;
|
||||
u8 previousKeys[8], currentKeys[8], pendingKeys[8];
|
||||
u32 repeatDelay[8];
|
||||
};
|
||||
class KeySet {
|
||||
public:
|
||||
KeySet() {}
|
||||
KeySet(const HKBManager* owner, u8 kind)
|
||||
: manager(owner), type(kind), index(-1), device(0), vcode(0) {}
|
||||
u8 GetKey() const;
|
||||
u32 GetWChar() const;
|
||||
u32 GetVCode() const;
|
||||
u32 IsValid() const;
|
||||
bool CheckValidity() const {
|
||||
if (!manager) return false;
|
||||
s8 keyIndex = index;
|
||||
if (keyIndex < 0 || keyIndex >= 8) return false;
|
||||
u8 keyDevice = device;
|
||||
if (keyDevice >= 2) return false;
|
||||
switch (type) {
|
||||
case 0: return (manager->states[keyDevice].held & (1 << keyIndex)) != 0;
|
||||
case 1: return (manager->states[keyDevice].triggered & (1 << keyIndex)) != 0;
|
||||
case 2: return (manager->states[keyDevice].released & (1 << keyIndex)) != 0;
|
||||
case 3: return (manager->states[keyDevice].repeated & (1 << keyIndex)) != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
KeySet GetNext() const;
|
||||
const HKBManager* manager;
|
||||
u8 type;
|
||||
s8 index;
|
||||
u8 device;
|
||||
mutable u16 vcode;
|
||||
};
|
||||
class KBDListenerOwn;
|
||||
class KBDListenerLinks {
|
||||
public:
|
||||
KBDListenerLinks() : previous(0), next(0) {}
|
||||
virtual ~KBDListenerLinks() {}
|
||||
virtual void OnAttach(KBDDevEvent*) = 0;
|
||||
virtual void OnDetach(KBDDevEvent*) = 0;
|
||||
virtual void OnKeyEvent(KBDKeyEvent*) = 0;
|
||||
KBDListenerOwn* previous;
|
||||
KBDListenerOwn* next;
|
||||
};
|
||||
class KBDListenerOwn : public KBDListenerLinks {
|
||||
public:
|
||||
KBDListenerOwn(HKBManager* owner) : manager(owner) {}
|
||||
virtual ~KBDListenerOwn();
|
||||
virtual void OnAttach(KBDDevEvent* event);
|
||||
virtual void OnDetach(KBDDevEvent* event);
|
||||
virtual void OnKeyEvent(KBDKeyEvent* event);
|
||||
HKBManager* manager;
|
||||
};
|
||||
HKBManager() __attribute__((never_inline));
|
||||
~HKBManager();
|
||||
static HKBManager& getInstance() { return sInstance; }
|
||||
void Initialize();
|
||||
void ClearState();
|
||||
u32 GetModifierState() const;
|
||||
void SetCountry(u8 country);
|
||||
void SetModifierState(u32 state, u32 mask);
|
||||
void SetForceModifierState(u32 state, u32 mask);
|
||||
void Update();
|
||||
KeySet GetTriggeredKeySet() const;
|
||||
KeySet GetReleasedKeySet() const;
|
||||
KeySet GetRepeatedKeySet() const;
|
||||
#ifdef TIHWKEYBOARD_IMPLEMENTATION
|
||||
KeySet GetReleasedKeySet() const;
|
||||
#endif
|
||||
static void SetLedCB(_KBDEc result, void* userData);
|
||||
static void AttachCB(KBDDevEvent* event);
|
||||
static void DetachCB(KBDDevEvent* event);
|
||||
static void KeyEventCB(KBDKeyEvent* event);
|
||||
private:
|
||||
u8 initialized;
|
||||
u8 attached[2];
|
||||
u32 lockState;
|
||||
u32 retryDevices;
|
||||
const wchar_t* allowedCharacters;
|
||||
u32 allowedCharacterCount;
|
||||
KeyState_ states[2];
|
||||
KBDListenerOwn listener;
|
||||
static HKBManager sInstance;
|
||||
};
|
||||
#else
|
||||
class HKBManager {
|
||||
public:
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
@@ -151,42 +22,15 @@ namespace textinput {
|
||||
u32 GetModifierState() const;
|
||||
void SetModifierState(u32, u32);
|
||||
|
||||
#if defined(TI_CELLPHONE_HKB_KEYSET)
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
class KeySet {
|
||||
public:
|
||||
u8 GetKey() const;
|
||||
u32 GetWChar() const;
|
||||
bool IsValid() const;
|
||||
KeySet GetNext() const;
|
||||
KeySet(const KeySet& other)
|
||||
: mpManager(other.mpManager), mKind(other.mKind), mIndex(other.mIndex),
|
||||
mDevice(other.mDevice), mCharacter(other.mCharacter) {}
|
||||
private:
|
||||
const HKBManager* mpManager;
|
||||
u8 mKind;
|
||||
s8 mIndex;
|
||||
u8 mDevice;
|
||||
u16 mCharacter;
|
||||
};
|
||||
KeySet GetTriggeredKeySet() const;
|
||||
KeySet GetRepeatedKeySet() const;
|
||||
#else
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)
|
||||
class KeySet {
|
||||
public:
|
||||
u8 GetKey() const;
|
||||
#ifdef TIHWKEYBOARD_IMPLEMENTATION
|
||||
u32 GetWChar() const;
|
||||
#else
|
||||
wchar_t GetWChar() const;
|
||||
#endif
|
||||
bool IsValid() const;
|
||||
KeySet GetNext() const;
|
||||
KeySet(const KeySet& other)
|
||||
: mpManager(other.mpManager), mKind(other.mKind), mIndex(other.mIndex), mDevice(other.mDevice), mCharacter(other.mCharacter) {}
|
||||
#ifdef TIHWKEYBOARD_IMPLEMENTATION
|
||||
KeySet() : mpManager(NULL), mKind(0), mIndex(-1), mDevice(0), mCharacter(0) {}
|
||||
#endif
|
||||
private:
|
||||
const HKBManager* mpManager;
|
||||
u8 mKind;
|
||||
@@ -196,9 +40,6 @@ namespace textinput {
|
||||
};
|
||||
KeySet GetTriggeredKeySet() const;
|
||||
KeySet GetRepeatedKeySet() const;
|
||||
#ifdef TIHWKEYBOARD_IMPLEMENTATION
|
||||
KeySet GetReleasedKeySet() const;
|
||||
#endif
|
||||
void SetForceModifierState(u32 mask, u32 state);
|
||||
#else
|
||||
class KeySet {
|
||||
@@ -207,29 +48,14 @@ namespace textinput {
|
||||
wchar_t szKeySetName[17]; // 0x04
|
||||
u16 uNum; // 0x26
|
||||
u16 uType; // 0x28
|
||||
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
public:
|
||||
bool IsValid() const;
|
||||
u32 GetKey() const;
|
||||
wchar_t GetWChar() const;
|
||||
KeySet GetNext() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
KeySet GetTriggeredKeySet() const;
|
||||
KeySet GetRepeatedKeySet() const;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
private:
|
||||
u8 unk_0x00[0xFC];
|
||||
|
||||
static HKBManager sInstance;
|
||||
};
|
||||
#endif
|
||||
} // namespace input
|
||||
} // namespace textinput
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace textinput {
|
||||
#endif
|
||||
|
||||
virtual void init();
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)
|
||||
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
|
||||
wchar_t convertWCCode(wchar_t code) const;
|
||||
#endif
|
||||
|
||||
@@ -40,11 +40,6 @@ namespace textinput {
|
||||
void resetQuoteState() { mbSingleQuoteClosing = 0; mbDoubleQuoteClosing = 0; }
|
||||
#endif
|
||||
private:
|
||||
#ifdef TIHWKEYBOARD_IMPLEMENTATION
|
||||
bool updateRepeatKey_(input::HKBManager&);
|
||||
bool updateTriggerKey_(input::HKBManager&);
|
||||
bool updateTappingShift_(input::HKBManager&);
|
||||
#endif
|
||||
void updateShift(input::HKBManager& hkbManager);
|
||||
void controlKeyTriggeredHandler(input::HKBManager);
|
||||
|
||||
@@ -55,14 +50,9 @@ namespace textinput {
|
||||
#ifdef TIINPUTFORM_IMPLEMENTATION
|
||||
u8 mbSingleQuoteClosing;
|
||||
u8 mbDoubleQuoteClosing;
|
||||
#else
|
||||
#ifdef TIHWKEYBOARD_IMPLEMENTATION
|
||||
bool field_0x15;
|
||||
bool field_0x16;
|
||||
#else
|
||||
u8 field_0x15; // 0x15
|
||||
u8 field_0x16; // 0x16
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -144,11 +144,6 @@ namespace textinput {
|
||||
|
||||
#ifdef TISIGNWINDOW_IMPLEMENTATION
|
||||
bool isAtokActive() const;
|
||||
#endif
|
||||
#ifdef MYTILETTERFORM_IMPLEMENTATION
|
||||
virtual void create(MEMAllocator* allocator);
|
||||
virtual void init();
|
||||
virtual void onCommand(INPUT_COMMAND command, void* data);
|
||||
#endif
|
||||
virtual ~Base();
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
@@ -289,7 +284,7 @@ namespace textinput {
|
||||
|
||||
virtual void makeUpCursorPos(CursorPos* cursorPos, u32 pos, s32 startLine, s32 endLine);
|
||||
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
protected:
|
||||
#if !defined(TIINPUTFORM_IMPLEMENTATION) && !defined(TIMANAGER_IMPLEMENTATION)
|
||||
void setCursorPos(tistring::Decolated* string, u32 pos);
|
||||
@@ -299,7 +294,7 @@ namespace textinput {
|
||||
#else
|
||||
private:
|
||||
#endif
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
nw4r::ut::Rect mRect;
|
||||
#else
|
||||
Rect mRect;
|
||||
@@ -384,13 +379,13 @@ namespace textinput {
|
||||
virtual void setRootPaneScaleFor16x9();
|
||||
virtual void setRootPaneScaleFor4x3();
|
||||
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual void onSE(sound::SE seId);
|
||||
#endif
|
||||
|
||||
virtual void visibleSeparator(bool flag);
|
||||
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
protected:
|
||||
const void* mpLayoutData;
|
||||
const void* mpLanguageData;
|
||||
|
||||
@@ -12,36 +12,27 @@ namespace textinput {
|
||||
KeyboardBase() : meLanguage(JP) {}
|
||||
#endif
|
||||
virtual ~KeyboardBase() {}
|
||||
#if !(defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) && !defined(TIMANAGER_IMPLEMENTATION) && !defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#if !defined(TI_PC_KEYBOARD_IMPLEMENTATION) && !defined(TIMANAGER_IMPLEMENTATION) && !defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual void create(MEMAllocator* alloc) override;
|
||||
virtual void init() override;
|
||||
|
||||
#ifndef TI_CELLPHONE_MATCH_LAYOUT
|
||||
virtual void setCommandReceiver(CommandReceiver* receiver) override;
|
||||
virtual void sendCommand(u32 command, void*) override;
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(TIMANAGER_IMPLEMENTATION) && !defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual void updateFromReceiver(u32, void*) override;
|
||||
#endif
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual void onKey(u32, void*);
|
||||
#else
|
||||
virtual void onKey(u32);
|
||||
#endif
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
virtual u32 getType();
|
||||
#elif (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
virtual int getType();
|
||||
#else
|
||||
virtual void getType();
|
||||
#endif
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
virtual void setLanguage(Language language) { meLanguage = language; }
|
||||
#else
|
||||
virtual void setLanguage(Language language);
|
||||
#endif
|
||||
#if (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#ifdef TISIGNWINDOW_IMPLEMENTATION
|
||||
virtual Language getLanguage() const;
|
||||
#else
|
||||
|
||||
@@ -120,9 +120,6 @@ namespace textinput {
|
||||
virtual void start() {}
|
||||
virtual void end() {}
|
||||
|
||||
#ifdef TIHWKEYBOARD_IMPLEMENTATION
|
||||
EventObserver* getEventObserverForHardware() const { return mpEventObserver; }
|
||||
#endif
|
||||
virtual InputForm* getInputForm() { return mpInputForm; }
|
||||
virtual const InputForm* getInputForm() const { return mpInputForm; }
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace textinput {
|
||||
class TiEventHandler : public gui::EventHandler {
|
||||
public:
|
||||
typedef struct Input {
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
u32 controller;
|
||||
f32 x;
|
||||
f32 y;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef TEXTINPUT_PC_KEYBOARD_H
|
||||
#define TEXTINPUT_PC_KEYBOARD_H
|
||||
|
||||
#if (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#include "tiPcKeyboardImpl.h"
|
||||
#else
|
||||
|
||||
@@ -65,11 +65,7 @@ namespace textinput {
|
||||
virtual void init() override;
|
||||
virtual void updateFromReceiver(u32, void*) override;
|
||||
virtual void onKey(u32, void*) override;
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
virtual u32 getType() override;
|
||||
#else
|
||||
virtual void getType() override;
|
||||
#endif
|
||||
virtual void setLanguage(Language) override;
|
||||
virtual void onActive() override;
|
||||
virtual void inputCharCode(u16);
|
||||
|
||||
@@ -226,12 +226,6 @@ namespace textinput {
|
||||
State mState;
|
||||
const LanguageData* mpInitialLanguageData;
|
||||
KeyState mKeyState;
|
||||
#ifdef TIHWKEYBOARD_IMPLEMENTATION
|
||||
public:
|
||||
KeyState& hardwareKeyState() { return mKeyState; }
|
||||
bool hardwareLanguageKeyActive() const { return mbLanguageKeyActive; }
|
||||
protected:
|
||||
#endif
|
||||
MEMAllocator* mpAllocator;
|
||||
bool mbOnlyQwerty;
|
||||
bool mbLanguageKeyActive;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <revolution/types.h>
|
||||
#include <revolution/mem/allocator.h>
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#include <revolution/kpr.h>
|
||||
#endif
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace textinput {
|
||||
virtual wchar_t* getWCString() const { return mpszString; }
|
||||
|
||||
virtual void setCandidate(wchar_t candidate) { mwcCandidate = candidate; }
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual wchar_t getCandidate() const { return mwcCandidate; }
|
||||
#else
|
||||
virtual wchar_t getCandidate() { return mwcCandidate; }
|
||||
@@ -48,11 +48,7 @@ namespace textinput {
|
||||
|
||||
virtual wchar_t getLastWChar();
|
||||
|
||||
#if defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
protected:
|
||||
#else
|
||||
private:
|
||||
#endif
|
||||
u16 muMaxLength; // 0x04
|
||||
u16 muLength; // 0x06
|
||||
|
||||
@@ -65,7 +61,7 @@ namespace textinput {
|
||||
};
|
||||
|
||||
class KanaStream {
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
public:
|
||||
KPRQueue mQueue;
|
||||
wchar_t mPending;
|
||||
@@ -78,13 +74,13 @@ namespace textinput {
|
||||
|
||||
class Decolated : public StringBase {
|
||||
public:
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
Decolated(u16 maxLen) : StringBase(maxLen), mCursorStart(0), mCursorEnd(0), mbSustain(false), mTranslateMode(0) { initKanaConverter(); }
|
||||
#else
|
||||
Decolated(u16 maxLen) : StringBase(maxLen), field_0x18(0), field_0x1C(0), field_0x20(0), field_0x24(0) { initKanaConverter(); }
|
||||
#endif
|
||||
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual ~Decolated();
|
||||
enum TranslateMode { TM_Direct, TM_Kana, TM_Roman, TM_Hangul };
|
||||
virtual void clear();
|
||||
@@ -107,7 +103,7 @@ namespace textinput {
|
||||
virtual u32 getCursorPos() const;
|
||||
virtual void getCursorPos(u32* start, u32* end);
|
||||
virtual bool canBackSpace();
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual bool deleteForward();
|
||||
#else
|
||||
virtual void deleteForward();
|
||||
@@ -165,21 +161,12 @@ namespace textinput {
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
protected:
|
||||
#else
|
||||
private:
|
||||
#endif
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
u32 mCursorStart;
|
||||
u32 mCursorEnd;
|
||||
#if defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
u8 mbSustain;
|
||||
s32 mTranslateMode;
|
||||
#else
|
||||
bool mbSustain;
|
||||
u32 mTranslateMode;
|
||||
#endif
|
||||
#else
|
||||
u32 field_0x18; // 0x18
|
||||
u32 field_0x1C; // 0x1C
|
||||
@@ -189,7 +176,7 @@ namespace textinput {
|
||||
KanaStream mKanaStream; // 0x28
|
||||
};
|
||||
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
class WithAtok : public Decolated {
|
||||
public:
|
||||
WithAtok(u16 maxLength) : Decolated(maxLength) {}
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
|
||||
#include <nw4r/ut/CharWriter.h>
|
||||
#include <nw4r/ut/Rect.h>
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
namespace textinput {
|
||||
namespace textdrawer {
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
class Base : public nw4r::ut::CharWriter {
|
||||
#else
|
||||
class Base : nw4r::ut::CharWriter {
|
||||
@@ -34,7 +34,7 @@ namespace textinput {
|
||||
} CursorPos;
|
||||
|
||||
typedef struct DrawInfo {
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
nw4r::ut::Rect rect;
|
||||
wchar_t character;
|
||||
#else
|
||||
@@ -94,7 +94,7 @@ namespace textinput {
|
||||
virtual u32 getEndPos() const;
|
||||
|
||||
// todo
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual void setDrawModifyScopeLine(s32 startLine, s32 endLine);
|
||||
virtual void setDrawCacheScopeLine(s32 startLine, s32 endLine);
|
||||
virtual void modifyCursorCache(s32 line, u32 position, f32 x, f32 y, f32 width, f32 height);
|
||||
@@ -103,12 +103,12 @@ namespace textinput {
|
||||
virtual void setDrawCacheScopeLine();
|
||||
virtual void modifyCursorCache();
|
||||
#endif
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual bool isEnableCursorCache() const;
|
||||
#else
|
||||
virtual void isEnableCursorCache();
|
||||
#endif
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual u32 getDrawModifyStartLine() const;
|
||||
virtual u32 getDrawModifyEndLine() const;
|
||||
#else
|
||||
@@ -119,42 +119,7 @@ namespace textinput {
|
||||
virtual void dirtyDrawCache();
|
||||
virtual void dirtyCursorCache();
|
||||
|
||||
#ifdef TITEXTDRAWER_IMPLEMENTATION
|
||||
protected:
|
||||
const wchar_t* mpDrawString;
|
||||
ViewPort mSavedViewport;
|
||||
f32 mSavedProjection[7];
|
||||
nw4r::ut::Rect mProjectionRect;
|
||||
f32 mfVIWidth;
|
||||
bool mbAspect4x3;
|
||||
bool mbDrawClipped;
|
||||
s32 muLine;
|
||||
f32 mfLineSpacing;
|
||||
f32 mfCharacterSpacing;
|
||||
f32 mfFontWidth;
|
||||
f32 mfFontHeight;
|
||||
f32 mfModifyStartY;
|
||||
f32 mfMinScrollY;
|
||||
u32 muDrawStartPos;
|
||||
u32 muDrawEndPos;
|
||||
u32 muDrawCacheStartPos;
|
||||
bool mbSecretMode;
|
||||
s32 muDrawModifyStartLine;
|
||||
s32 muDrawModifyEndLine;
|
||||
s32 muDrawModifyStartPos;
|
||||
s32 muDrawModifyEndPos;
|
||||
u32 muCachedStartPos;
|
||||
u32 muCachedEndPos;
|
||||
bool mbDrawCache;
|
||||
f32 mfCachedCursorX;
|
||||
f32 mfCachedCursorY;
|
||||
f32 mfDrawScrollY;
|
||||
s32 mnCachedCursorLine;
|
||||
CursorPos mCachedCursor;
|
||||
bool mbCursorCache;
|
||||
bool mbMaintainCursorCache;
|
||||
#else
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
protected:
|
||||
MEMAllocator* mpDrawAllocator;
|
||||
u8 mDrawConfiguration[0x34];
|
||||
@@ -180,7 +145,7 @@ namespace textinput {
|
||||
u8 unk_0x50[0x78];
|
||||
#endif
|
||||
bool mbSecretMode; // 0xC8
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TITEXTDRAWER_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
u32 muDrawModifyStartLine;
|
||||
u32 muDrawModifyEndLine;
|
||||
u32 muDrawModifyStartPos;
|
||||
@@ -202,7 +167,6 @@ namespace textinput {
|
||||
u8 mDrawCacheState[0x14];
|
||||
#else
|
||||
u8 unk_0xCC[0x3C];
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,14 +54,11 @@ namespace textinput {
|
||||
class CommandSender;
|
||||
class CommandReceiver : public Base {
|
||||
public:
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
struct ChangePredictMode;
|
||||
#endif
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
CommandReceiver() { clearSender(); }
|
||||
virtual ~CommandReceiver();
|
||||
#endif
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
struct Scroll {
|
||||
bool absY;
|
||||
f32 x;
|
||||
@@ -73,7 +70,7 @@ namespace textinput {
|
||||
INPUT_COMMAND_37 = 37,
|
||||
} INPUT_COMMAND;
|
||||
|
||||
#if (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISIGNWINDOW_IMPLEMENTATION)
|
||||
struct ChangePredictMode { u32 mode; bool enabled; };
|
||||
#endif
|
||||
virtual void clearSender();
|
||||
@@ -89,7 +86,7 @@ namespace textinput {
|
||||
CommandSender() : mpCommandReceiver(NULL) {}
|
||||
|
||||
virtual void setCommandReceiver(CommandReceiver* cmdRecv);
|
||||
#if (defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIHWKEYBOARD_IMPLEMENTATION)) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(TI_PC_KEYBOARD_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
virtual void sendCommand(u32 command, void* data) {
|
||||
if (mpCommandReceiver != NULL) mpCommandReceiver->onCommand(static_cast<CommandReceiver::INPUT_COMMAND>(command), data);
|
||||
}
|
||||
|
||||
@@ -56,19 +56,10 @@ namespace textinput {
|
||||
virtual void onOK();
|
||||
virtual void onCancel();
|
||||
virtual void setQwertyWithSE(bool qwerty);
|
||||
#ifdef TI_CELLPHONE_IMPLEMENTATION
|
||||
virtual bool isEnableKeytopChange() const { return mbIsEnableQwertyChg; }
|
||||
#else
|
||||
virtual bool isEnableKeytopChange() const;
|
||||
#endif
|
||||
virtual void enableKeytopChange(bool enable);
|
||||
#ifdef MYTIMANAGER_MATCHING
|
||||
virtual nw4r::lyt::Pane* getDownArea();
|
||||
virtual nw4r::lyt::Pane* getUpArea();
|
||||
#else
|
||||
virtual nw4r::lyt::Pane* getUpArea();
|
||||
virtual nw4r::lyt::Pane* getDownArea();
|
||||
#endif
|
||||
virtual void setOKButtonVisible(bool visible);
|
||||
virtual void setCancelButtonVisible(bool visible);
|
||||
virtual void setOKButtonCaption(const wchar_t* caption);
|
||||
|
||||
@@ -20,15 +20,9 @@ namespace textinput {
|
||||
wchar_t KBD_ConvertSmall(wchar_t ch);
|
||||
wchar_t KBD_ConvertAll(wchar_t ch);
|
||||
|
||||
#ifdef TISTRING_IMPLEMENTATION
|
||||
u32 KBD_IsDakuten(wchar_t ch);
|
||||
u32 KBD_IsHandaku(wchar_t ch);
|
||||
u32 KBD_IsSmall(wchar_t ch);
|
||||
#else
|
||||
bool KBD_IsDakuten(wchar_t ch);
|
||||
bool KBD_IsHandaku(wchar_t ch);
|
||||
bool KBD_IsSmall(wchar_t ch);
|
||||
#endif
|
||||
|
||||
bool strcmp(const char* s1, const char* s2);
|
||||
void replaceChar(char* dest, u32 destLen, const char* src, int replaceIdx, char newCh);
|
||||
|
||||
@@ -1,102 +1,14 @@
|
||||
#ifndef TEXTINPUT_ZI_STRING_H
|
||||
#define TEXTINPUT_ZI_STRING_H
|
||||
|
||||
#if defined(TIZISTRING_IMPLEMENTATION)
|
||||
#include "tiString.h"
|
||||
extern "C" {
|
||||
#include <eztx.h>
|
||||
}
|
||||
#elif defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#include "tiString.h"
|
||||
#include <eztx.h>
|
||||
#endif
|
||||
|
||||
namespace textinput {
|
||||
namespace tistring {
|
||||
#if defined(TIZISTRING_IMPLEMENTATION)
|
||||
class WithZi : public Decolated {
|
||||
public:
|
||||
enum PredictLanguage {
|
||||
PL_0,
|
||||
PL_1,
|
||||
PL_2,
|
||||
PL_3,
|
||||
PL_4,
|
||||
PL_5,
|
||||
PL_6,
|
||||
PL_7,
|
||||
PL_8,
|
||||
PL_9,
|
||||
PL_10,
|
||||
PL_11
|
||||
};
|
||||
|
||||
enum LetterMode {
|
||||
LM_0,
|
||||
LM_1,
|
||||
LM_2,
|
||||
LM_3
|
||||
};
|
||||
|
||||
static u16 ElementBuffer[0x100];
|
||||
static u16 CandidatesBuffer[0x300];
|
||||
static u16 CandidatedWord[0xa00];
|
||||
static u16 LatestWord[0x40];
|
||||
|
||||
virtual ~WithZi();
|
||||
virtual void create(MEMAllocator*);
|
||||
virtual void pushBack(wchar_t);
|
||||
virtual void popBack();
|
||||
virtual void clear();
|
||||
virtual void inputChar(wchar_t);
|
||||
virtual void backSpace();
|
||||
virtual void confirm(const wchar_t*);
|
||||
virtual bool moveCursorRight();
|
||||
virtual bool moveCursorLeft();
|
||||
virtual bool canBackSpace();
|
||||
virtual void EnableKSXFilter(bool);
|
||||
virtual void init();
|
||||
virtual void setInputting(wchar_t);
|
||||
virtual u32 getCurrentNumPredicted();
|
||||
virtual void getPredicted(int, wchar_t*);
|
||||
virtual wchar_t* getCurrentSelected();
|
||||
virtual u16 getInputStringLength();
|
||||
virtual void setSelectedCandidate(s32);
|
||||
virtual bool isFix();
|
||||
virtual void setPredictLaunguage(PredictLanguage);
|
||||
virtual void changeLetterMode(LetterMode);
|
||||
virtual void ChangeDictionaryLanguage(u8);
|
||||
virtual void setCellPhoneHoldingkey(void*);
|
||||
virtual u32 setElementBuffer();
|
||||
virtual u8 getPredictLanguage();
|
||||
void openDictionary(void*, void*);
|
||||
void clearCandidates();
|
||||
void partialConfirmForKR();
|
||||
void update();
|
||||
u32 complementsCandidates_(s32);
|
||||
void setCurrentWord(const wchar_t*);
|
||||
u32 getCurrentInput(wchar_t*, u32);
|
||||
wchar_t* getCurrentInput();
|
||||
|
||||
private:
|
||||
EZTXGetParam mSearch;
|
||||
u32 mSearchState;
|
||||
u8 mbDictionaryOpen;
|
||||
u8 mbContextChanged;
|
||||
u32 mCurrentWordLength;
|
||||
EZTXLanguageEntry* mpDictionaries;
|
||||
void* mpDictionaryWork;
|
||||
u16 mInputLength;
|
||||
u32 mCandidateCount;
|
||||
u32 mOemDictionaryId;
|
||||
u8 mDictionaryLanguage;
|
||||
s32 mSelectedCandidate;
|
||||
PredictLanguage mPredictLanguage;
|
||||
LetterMode mLetterMode;
|
||||
void* mpHoldingKey;
|
||||
u8 mbKoreanPartialConfirm;
|
||||
};
|
||||
#elif defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
class WithZi : public Decolated {
|
||||
public:
|
||||
enum PredictLanguage { PL_Default };
|
||||
|
||||
@@ -20,11 +20,7 @@ namespace gui {
|
||||
class Manager;
|
||||
class EventHandler;
|
||||
|
||||
#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
|
||||
class __declspec(novtable) Interface {
|
||||
#else
|
||||
class Interface {
|
||||
#endif
|
||||
public:
|
||||
virtual void create() {} // 0x08 (0x02)
|
||||
|
||||
@@ -34,14 +30,14 @@ namespace gui {
|
||||
virtual void draw(Mtx& mtx) {} // 0x14 (0x05)
|
||||
virtual void draw() {} // 0x18 (0x06)
|
||||
|
||||
#if defined(IPL_CHANNEL_TITLE_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
|
||||
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
virtual ~Interface(); // 0x1C (0x07)
|
||||
#else
|
||||
virtual ~Interface() {} // 0x1C (0x07)
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(IPL_CHANNEL_TITLE_NOVTABLE) || defined(IPL_GC_WINDOW_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
|
||||
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
class __declspec(novtable) EventHandler {
|
||||
#else
|
||||
class EventHandler {
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace ipl {
|
||||
mbDisableCon(bDisableCon) {}
|
||||
#endif
|
||||
|
||||
#if defined(IPL_CHANNEL_TITLE_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE)
|
||||
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
virtual ~PaneManager();
|
||||
#else
|
||||
virtual ~PaneManager() {}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace ipl {
|
||||
HermiteIntp() {}
|
||||
virtual ~HermiteIntp();
|
||||
|
||||
void init(const T& start, const T& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f);
|
||||
void init(const T& start, const T& end, f32 maxFrame, f32 param_5, f32 param_6, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f);
|
||||
|
||||
T get() const {
|
||||
f32 var_f27 = mFrame;
|
||||
@@ -81,11 +81,11 @@ namespace ipl {
|
||||
(mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
||||
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))));
|
||||
r +=
|
||||
(mStartTangent *
|
||||
(unkVal0 *
|
||||
(var_f27 +
|
||||
((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
||||
(var_f28 * (2.0f * var_f27 * var_f27))))) +
|
||||
(mEndTangent * ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
||||
(unkVal1 * ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
||||
(var_f28 * (var_f27 * var_f27))));
|
||||
|
||||
return r;
|
||||
@@ -101,7 +101,7 @@ namespace ipl {
|
||||
f32 temp_f4 = var_f27 * var_f27;
|
||||
f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4));
|
||||
f32 temp_f3 =
|
||||
(mStartTangent * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (mEndTangent * (temp_f7 - (var_f28 * temp_f4)));
|
||||
(unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4)));
|
||||
r = r + temp_f3;
|
||||
return r;*/
|
||||
}
|
||||
@@ -109,8 +109,8 @@ namespace ipl {
|
||||
protected:
|
||||
T mStart;
|
||||
T mEnd;
|
||||
f32 mStartTangent;
|
||||
f32 mEndTangent;
|
||||
f32 unkVal0;
|
||||
f32 unkVal1;
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -119,7 +119,7 @@ namespace ipl {
|
||||
HermiteIntp() {}
|
||||
virtual ~HermiteIntp();
|
||||
|
||||
void init(const f32& start, const f32& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD,
|
||||
void init(const f32& start, const f32& end, f32 maxFrame, f32 param_5, f32 param_6, int playback = ANIM_TYPE_FORWARD,
|
||||
f32 speed = 1.0f);
|
||||
|
||||
f32 get() const {
|
||||
@@ -132,10 +132,10 @@ namespace ipl {
|
||||
(mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
||||
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))));
|
||||
r +=
|
||||
(mStartTangent *
|
||||
(unkVal0 *
|
||||
(var_f27 + ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
||||
(var_f28 * (2.0f * var_f27 * var_f27))))) +
|
||||
(mEndTangent * ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
||||
(unkVal1 * ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
||||
(var_f28 * (var_f27 * var_f27))));
|
||||
|
||||
return r;
|
||||
@@ -144,8 +144,8 @@ namespace ipl {
|
||||
protected:
|
||||
f32 mStart;
|
||||
f32 mEnd;
|
||||
f32 mStartTangent;
|
||||
f32 mEndTangent;
|
||||
f32 unkVal0;
|
||||
f32 unkVal1;
|
||||
};
|
||||
|
||||
#pragma dont_instantiate HermiteIntp<float>
|
||||
@@ -155,36 +155,14 @@ namespace ipl {
|
||||
public:
|
||||
HermiteIntp() {}
|
||||
|
||||
void init(const T& start, const T& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f) {
|
||||
void init(const T& start, const T& end, f32 maxFrame, f32 param_5, f32 param_6, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f) {
|
||||
mStart = start;
|
||||
mEnd = end;
|
||||
utility::FrameController::init(playback, maxFrame, 0.0f, speed);
|
||||
mStartTangent = startTangent;
|
||||
mEndTangent = endTangent;
|
||||
unkVal0 = param_5;
|
||||
unkVal1 = param_6;
|
||||
}
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_SELECT_CPP
|
||||
T get() const {
|
||||
f32 frame = mFrame;
|
||||
f32 inverseDuration = 1.0f / mMaxFrame;
|
||||
T result =
|
||||
(mStart * (1.0f + (inverseDuration * (inverseDuration *
|
||||
(inverseDuration * (frame * (2.0f * frame * frame)))) -
|
||||
inverseDuration * (inverseDuration * (3.0f * frame * frame))))) -
|
||||
(mEnd * (inverseDuration * (inverseDuration *
|
||||
(inverseDuration * (frame * (2.0f * frame * frame)))) -
|
||||
inverseDuration * (inverseDuration * (3.0f * frame * frame))));
|
||||
f32 frameSquared = frame * frame;
|
||||
f32 cubic = inverseDuration * (inverseDuration * (frame * frameSquared));
|
||||
f32 tangent = mStartTangent * (frame + (cubic -
|
||||
inverseDuration * (2.0f * frame * frame))) +
|
||||
mEndTangent * (cubic - inverseDuration * frameSquared);
|
||||
result.x += tangent;
|
||||
result.y += tangent;
|
||||
result.z += tangent;
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
T get() const {
|
||||
f32 var_f27 = mFrame;
|
||||
f32 var_f28 = 1.0f / mMaxFrame;
|
||||
@@ -196,7 +174,7 @@ namespace ipl {
|
||||
f32 temp_f4 = var_f27 * var_f27;
|
||||
f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4));
|
||||
f32 temp_f3 =
|
||||
(mStartTangent * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (mEndTangent * (temp_f7 - (var_f28 * temp_f4)));
|
||||
(unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4)));
|
||||
|
||||
r = r + temp_f3;
|
||||
|
||||
@@ -213,55 +191,14 @@ namespace ipl {
|
||||
f32 temp_f4 = var_f27 * var_f27;
|
||||
f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4));
|
||||
f32 temp_f3 =
|
||||
(mStartTangent * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (mEndTangent * (temp_f7 - (var_f28 * temp_f4)));
|
||||
(unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4)));
|
||||
r = r + temp_f3;
|
||||
return r;*/
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
f32 mStartTangent;
|
||||
f32 mEndTangent;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_SELECT_CPP
|
||||
} // namespace math
|
||||
} // namespace ipl
|
||||
#include "math/iplMathTypes.h"
|
||||
namespace ipl {
|
||||
namespace math {
|
||||
template <>
|
||||
class HermiteIntp<VEC3> : public utility::FrameController {
|
||||
public:
|
||||
HermiteIntp() {}
|
||||
virtual ~HermiteIntp();
|
||||
void init(const VEC3& start, const VEC3& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f);
|
||||
VEC3 get() const {
|
||||
f32 frame = mFrame;
|
||||
f32 inverseDuration = 1.0f / mMaxFrame;
|
||||
VEC3 result =
|
||||
(mStart * (1.0f + (inverseDuration * (inverseDuration *
|
||||
(inverseDuration * (frame * (2.0f * frame * frame)))) -
|
||||
inverseDuration * (inverseDuration * (3.0f * frame * frame))))) -
|
||||
(mEnd * (inverseDuration * (inverseDuration *
|
||||
(inverseDuration * (frame * (2.0f * frame * frame)))) -
|
||||
inverseDuration * (inverseDuration * (3.0f * frame * frame))));
|
||||
f32 frameSquared = frame * frame;
|
||||
f32 cubic = inverseDuration * (inverseDuration * (frame * frameSquared));
|
||||
f32 tangent = mStartTangent * (frame + (cubic -
|
||||
inverseDuration * (2.0f * frame * frame))) +
|
||||
mEndTangent * (cubic - inverseDuration * frameSquared);
|
||||
result.x += tangent;
|
||||
result.y += tangent;
|
||||
result.z += tangent;
|
||||
return result;
|
||||
}
|
||||
protected:
|
||||
VEC3 mStart;
|
||||
VEC3 mEnd;
|
||||
f32 mStartTangent;
|
||||
f32 mEndTangent;
|
||||
f32 unkVal0;
|
||||
f32 unkVal1;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -134,15 +134,7 @@ namespace ipl {
|
||||
VEC3& operator/=(f32 val) { return operator*=(1.f / val); }
|
||||
VEC3 operator+(const VEC3& rhs) const { return VEC3(x + rhs.x, y + rhs.y, z + rhs.z); }
|
||||
VEC3 operator+(f32 v) const { return VEC3(x + v, y + v, z + v); }
|
||||
#ifdef IPL_SD_CHANNEL_SELECT_CPP
|
||||
nw4r::math::VEC3 operator-(const VEC3& rhs) const {
|
||||
nw4r::math::VEC3 difference;
|
||||
nw4r::math::VEC3Sub(&difference, this, &rhs);
|
||||
return difference;
|
||||
}
|
||||
#else
|
||||
VEC3 operator-(const VEC3& rhs) const { return VEC3(x - rhs.x, y - rhs.y, z - rhs.z); }
|
||||
#endif
|
||||
VEC3 operator*(f32 val) const { return VEC3(x * val, y * val, z * val); }
|
||||
VEC3 operator*(f64 val) const {
|
||||
nw4r::math::VEC3 vecOut;
|
||||
|
||||
@@ -86,7 +86,6 @@ namespace ipl {
|
||||
|
||||
const utility::BScroller& getBInst() { return mBScroller; }
|
||||
#ifdef IPL_SDMEMORY_SCROLLER_BINST_RESET
|
||||
void initScroll() { mScroller.init(); }
|
||||
void resetBInst() { mBScroller.reset(); }
|
||||
#endif
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
class GCWindow : public MemoryBase, public MemCardEventListener {
|
||||
class GCWindow : public MemoryBase, public MemCardEventHandler {
|
||||
#ifdef IPL_MEMORY_CARD_CPP
|
||||
friend class MemoryCard;
|
||||
#endif
|
||||
@@ -48,25 +48,6 @@ private:
|
||||
void set_texture(const char*, const GXTexObj&);
|
||||
public:
|
||||
virtual void onMemEvent(long, u8);
|
||||
#ifdef IPL_GC_WINDOW_CPP
|
||||
virtual void on_wait_anim() = 0;
|
||||
virtual void on_exit() = 0;
|
||||
virtual void on_error() = 0;
|
||||
virtual void on_format() = 0;
|
||||
virtual void on_dialog_result() = 0;
|
||||
virtual void on_select_in() = 0;
|
||||
virtual void on_message_done() = 0;
|
||||
virtual void on_button_trig() = 0;
|
||||
#else
|
||||
virtual void on_wait_anim();
|
||||
virtual void on_exit();
|
||||
virtual void on_error();
|
||||
virtual void on_format();
|
||||
virtual void on_dialog_result();
|
||||
virtual void on_select_in();
|
||||
virtual void on_message_done();
|
||||
virtual void on_button_trig();
|
||||
#endif
|
||||
bool isProcess();
|
||||
void stop_wait_anim();
|
||||
|
||||
|
||||
@@ -35,11 +35,7 @@ namespace ipl {
|
||||
MemoryBase* mpBase; // 0x0C
|
||||
};
|
||||
|
||||
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
class __declspec(novtable) MemoryBase {
|
||||
#else
|
||||
class MemoryBase {
|
||||
#endif
|
||||
public:
|
||||
class Anm {
|
||||
public:
|
||||
|
||||
@@ -12,61 +12,13 @@
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
class __declspec(novtable) MemCardEventListener {
|
||||
public:
|
||||
MemCardEventListener() {}
|
||||
|
||||
virtual ~MemCardEventListener() {}
|
||||
|
||||
virtual void onMemEvent(long event, u8 slot);
|
||||
};
|
||||
|
||||
class MemCardEventHandler : public MemCardEventListener {
|
||||
class MemCardEventHandler {
|
||||
public:
|
||||
MemCardEventHandler() {}
|
||||
|
||||
virtual ~MemCardEventHandler();
|
||||
|
||||
virtual void onMemEvent(long event, u8 slot);
|
||||
|
||||
virtual void onMount(u8 slot) = 0;
|
||||
virtual void onUnmount(u8 slot) = 0;
|
||||
virtual void onAttach(u8 slot) = 0;
|
||||
virtual void onDetach(u8 slot) = 0;
|
||||
virtual void onCheck(u8 slot) = 0;
|
||||
virtual void onFormat(u8 slot) = 0;
|
||||
virtual void onRepair(u8 slot) = 0;
|
||||
virtual void onRead(u8 slot) = 0;
|
||||
virtual void onWrite(u8 slot) = 0;
|
||||
virtual void onOpen(u8 slot) = 0;
|
||||
virtual void onClose(u8 slot) = 0;
|
||||
virtual void onCreate(u8 slot) = 0;
|
||||
virtual void onDelete(u8 slot) = 0;
|
||||
virtual void onCopy(u8 slot) = 0;
|
||||
virtual void onMove(u8 slot) = 0;
|
||||
virtual void onRename(u8 slot) = 0;
|
||||
virtual void onVerify(u8 slot) = 0;
|
||||
virtual void onCommit(u8 slot) = 0;
|
||||
virtual void onProbe(u8 slot) = 0;
|
||||
virtual void onMountAsync(u8 slot) = 0;
|
||||
virtual void onUnmountAsync(u8 slot) = 0;
|
||||
virtual void onCheckAsync(u8 slot) = 0;
|
||||
virtual void onFormatAsync(u8 slot) = 0;
|
||||
virtual void onReadAsync(u8 slot) = 0;
|
||||
virtual void onWriteAsync(u8 slot) = 0;
|
||||
virtual void onCreateAsync(u8 slot) = 0;
|
||||
virtual void onDeleteAsync(u8 slot) = 0;
|
||||
virtual void onCopyAsync(u8 slot) = 0;
|
||||
virtual void onMoveAsync(u8 slot) = 0;
|
||||
virtual void onRenameAsync(u8 slot) = 0;
|
||||
virtual void onVerifyAsync(u8 slot) = 0;
|
||||
virtual void onCommitAsync(u8 slot) = 0;
|
||||
virtual void onProbeAsync(u8 slot) = 0;
|
||||
virtual void onFreeBlocks(u8 slot) = 0;
|
||||
virtual void onGetLength(u8 slot) = 0;
|
||||
virtual void onSetAttrib(u8 slot) = 0;
|
||||
virtual void onGetAttrib(u8 slot) = 0;
|
||||
virtual void onSlotStatus(u8 slot) = 0;
|
||||
};
|
||||
|
||||
typedef struct MCFile {
|
||||
@@ -104,44 +56,6 @@ namespace ipl {
|
||||
}
|
||||
virtual ~MemoryCardManager();
|
||||
|
||||
virtual void onMount(u8 slot) = 0;
|
||||
virtual void onUnmount(u8 slot) = 0;
|
||||
virtual void onAttach(u8 slot) = 0;
|
||||
virtual void onDetach(u8 slot) = 0;
|
||||
virtual void onCheck(u8 slot) = 0;
|
||||
virtual void onFormat(u8 slot) = 0;
|
||||
virtual void onRepair(u8 slot) = 0;
|
||||
virtual void onRead(u8 slot) = 0;
|
||||
virtual void onWrite(u8 slot) = 0;
|
||||
virtual void onOpen(u8 slot) = 0;
|
||||
virtual void onClose(u8 slot) = 0;
|
||||
virtual void onCreate(u8 slot) = 0;
|
||||
virtual void onDelete(u8 slot) = 0;
|
||||
virtual void onCopy(u8 slot) = 0;
|
||||
virtual void onMove(u8 slot) = 0;
|
||||
virtual void onRename(u8 slot) = 0;
|
||||
virtual void onVerify(u8 slot) = 0;
|
||||
virtual void onCommit(u8 slot) = 0;
|
||||
virtual void onProbe(u8 slot) = 0;
|
||||
virtual void onMountAsync(u8 slot) = 0;
|
||||
virtual void onUnmountAsync(u8 slot) = 0;
|
||||
virtual void onCheckAsync(u8 slot) = 0;
|
||||
virtual void onFormatAsync(u8 slot) = 0;
|
||||
virtual void onReadAsync(u8 slot) = 0;
|
||||
virtual void onWriteAsync(u8 slot) = 0;
|
||||
virtual void onCreateAsync(u8 slot) = 0;
|
||||
virtual void onDeleteAsync(u8 slot) = 0;
|
||||
virtual void onCopyAsync(u8 slot) = 0;
|
||||
virtual void onMoveAsync(u8 slot) = 0;
|
||||
virtual void onRenameAsync(u8 slot) = 0;
|
||||
virtual void onVerifyAsync(u8 slot) = 0;
|
||||
virtual void onCommitAsync(u8 slot) = 0;
|
||||
virtual void onProbeAsync(u8 slot) = 0;
|
||||
virtual void onFreeBlocks(u8 slot) = 0;
|
||||
virtual void onGetLength(u8 slot) = 0;
|
||||
virtual void onSetAttrib(u8 slot) = 0;
|
||||
virtual void onGetAttrib(u8 slot) = 0;
|
||||
|
||||
void calc();
|
||||
|
||||
bool isSlotReady(u8 slot);
|
||||
@@ -182,7 +96,7 @@ namespace ipl {
|
||||
u16 getFreeBlocks(u8 slot);
|
||||
#endif
|
||||
|
||||
void setEventHandler(MemCardEventListener* eventHandler) {
|
||||
void setEventHandler(MemCardEventHandler* eventHandler) {
|
||||
mpEventHandler = eventHandler;
|
||||
}
|
||||
|
||||
@@ -193,7 +107,7 @@ namespace ipl {
|
||||
s32 mLastResult; // 0x16930
|
||||
s32 mLastCmd; // 0x16934
|
||||
u32 unk_0x16938; // 0x16938
|
||||
MemCardEventListener* mpEventHandler; // 0x1693C
|
||||
MemCardEventHandler* mpEventHandler; // 0x1693C
|
||||
};
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
@@ -312,33 +312,6 @@ namespace ipl {
|
||||
void setLayoutFrame(int state);
|
||||
BOOL tellStartingZoomAnm();
|
||||
void initPageAnimations(const math::VEC3& position, int direction);
|
||||
#ifdef IPL_SD_CHANNEL_SELECT_CPP
|
||||
void removeNandTitleInfo(ESTitleId titleId) {
|
||||
u32 titleCount = mNandTitleCount;
|
||||
u32 index = 0;
|
||||
for (; index < titleCount; ++index) {
|
||||
if (mpNandTitleInfo[index].curTitleId == titleId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index < mNandTitleCount) {
|
||||
for (; index < mNandTitleCount - 1; ++index) {
|
||||
NandSDWorker::TitleUsage& nextTitle = mpNandTitleInfo[index + 1];
|
||||
NandSDWorker::TitleUsage& currentTitle = mpNandTitleInfo[index];
|
||||
currentTitle.curTitleId = nextTitle.curTitleId;
|
||||
currentTitle.size = nextTitle.size;
|
||||
currentTitle.inode = nextTitle.inode;
|
||||
}
|
||||
--mNandTitleCount;
|
||||
}
|
||||
}
|
||||
nw4r::math::VEC3 getPageTransitionPosition(int index) const {
|
||||
nw4r::math::VEC3 position(0.0f, 0.0f, 0.0f);
|
||||
nw4r::lyt::Pane* pane = getCenterChannelPane(index);
|
||||
PSMTXMultVec(pane->GetGlobalMtx(), position, position);
|
||||
return position;
|
||||
}
|
||||
#endif
|
||||
static BOOL isChannelReady(const SDChannelObj* channel);
|
||||
nw4r::ut::List mChannelObjects;
|
||||
nand::LayoutFile* mpLayoutFile;
|
||||
@@ -395,9 +368,9 @@ namespace ipl {
|
||||
NandSDWorker* mpSDWorker;
|
||||
ESTitleId32* mpSDTitleIds;
|
||||
SDChannelSelectTitleInfo* mpSDTitleInfo;
|
||||
mutable NandSDWorker::TitleUsage* mpNandTitleInfo;
|
||||
mutable s32 mFirstTitleCount;
|
||||
mutable s32 mSecondTitleCount;
|
||||
NandSDWorker::TitleUsage* mpNandTitleInfo;
|
||||
s32 mFirstTitleCount;
|
||||
s32 mSecondTitleCount;
|
||||
SDChannelObj* mpCurrentLoadedChannel;
|
||||
u32 mSDTitleCount;
|
||||
u32 mNandTitleCount;
|
||||
|
||||
@@ -29,9 +29,6 @@ namespace ipl {
|
||||
class Setting;
|
||||
class APScanThread;
|
||||
|
||||
#ifdef IPL_SETTING_IMPLEMENTATION
|
||||
class APEvent;
|
||||
#else
|
||||
class APEvent : public ::gui::EventHandler {
|
||||
public:
|
||||
APEvent(Setting* setting) : ::gui::EventHandler(), mpSetting(setting) {}
|
||||
@@ -41,17 +38,16 @@ namespace ipl {
|
||||
private:
|
||||
Setting* mpSetting;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct SettingAnimation {
|
||||
u8 unknown[0x14];
|
||||
int state;
|
||||
};
|
||||
|
||||
struct SettingAPScanList {
|
||||
u8 unknown[0x14];
|
||||
union {
|
||||
struct {
|
||||
u16 count;
|
||||
u8 entries[0x7fe];
|
||||
};
|
||||
u8 recordBuffer[0x800];
|
||||
};
|
||||
u16 count;
|
||||
u8 entries[0x7fe];
|
||||
union {
|
||||
WDBssDesc_* currentDescriptor;
|
||||
u16* currentDescriptorWords;
|
||||
@@ -90,7 +86,7 @@ namespace ipl {
|
||||
void initHTMLText();
|
||||
void initMessage();
|
||||
void initKeyboard(const char* text);
|
||||
bool checkInputString(const wchar_t* text) NO_INLINE;
|
||||
bool checkInputString(const wchar_t* text);
|
||||
int checkIPString(const wchar_t* text);
|
||||
void setDefaultBackString();
|
||||
void calcKeyboard();
|
||||
@@ -162,6 +158,7 @@ namespace ipl {
|
||||
virtual void destroy();
|
||||
virtual void prepare();
|
||||
virtual void create();
|
||||
virtual void calc();
|
||||
virtual void draw();
|
||||
virtual FaderSceneCommand calcFadein();
|
||||
virtual FaderSceneCommand calcNormal();
|
||||
@@ -211,8 +208,8 @@ namespace ipl {
|
||||
layout::Object* mpChangeLayout;
|
||||
layout::Object* mpMainLayout;
|
||||
layout::Object* mpWaitLayout;
|
||||
utility::FrameController* mpFirstAnimation;
|
||||
utility::FrameController* mpSecondAnimation;
|
||||
SettingAnimation* mpFirstAnimation;
|
||||
SettingAnimation* mpSecondAnimation;
|
||||
APEvent* mpEventHandler;
|
||||
gui::PaneManager* mpPaneManager;
|
||||
void* mpUSBAPThread;
|
||||
@@ -265,17 +262,6 @@ namespace ipl {
|
||||
#endif
|
||||
|
||||
};
|
||||
#ifdef IPL_SETTING_IMPLEMENTATION
|
||||
class APEvent : public ::gui::EventHandler {
|
||||
public:
|
||||
APEvent(Setting* setting) : ::gui::EventHandler(), mpSetting(setting) {}
|
||||
|
||||
virtual void onEvent(u32 componentID, u32 event, void* data);
|
||||
|
||||
private:
|
||||
Setting* mpSetting;
|
||||
};
|
||||
#endif
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
|
||||
@@ -20,10 +20,6 @@ namespace ipl {
|
||||
return mState == STATE_WAIT_CHILD;
|
||||
}
|
||||
|
||||
#ifdef IPL_MEMORYCARD_BASE_IMPLEMENTATION
|
||||
int getMemoryCardTransitionState() const { return mState; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
enum {
|
||||
// Base
|
||||
|
||||
@@ -38,49 +38,21 @@ namespace ipl {
|
||||
int holdSE(const char* sndName);
|
||||
int holdSEwithPosDis(const char* sndName, f32 x, f32 y);
|
||||
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
void stopBGM(int unk = 0);
|
||||
#else
|
||||
int stopBGM(int unk = 0);
|
||||
#endif
|
||||
int stopBGM(nw4r::snd::SoundHandle* handle, int unk = 0);
|
||||
int stopSE(nw4r::snd::SoundHandle* handle, int unk = 0);
|
||||
void stopAllSound(int unk = 0);
|
||||
|
||||
int resetAllSound();
|
||||
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
void muteOffBGM(int);
|
||||
#else
|
||||
int muteOffBGM(int);
|
||||
#endif
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
void muteOnBGM(int);
|
||||
#else
|
||||
int muteOnBGM(int);
|
||||
#endif
|
||||
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
void pauseOnBGM();
|
||||
#else
|
||||
int pauseOnBGM();
|
||||
#endif
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
void pauseOffBGM();
|
||||
#else
|
||||
int pauseOffBGM();
|
||||
#endif
|
||||
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
void pauseOnSE();
|
||||
#else
|
||||
int pauseOnSE();
|
||||
#endif
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
void pauseOffSE();
|
||||
#else
|
||||
int pauseOffSE();
|
||||
#endif
|
||||
|
||||
void setOutputMode(EAudioOutputMode mode);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace ipl {
|
||||
void stt_wait_fns_msg();
|
||||
void stt_wait_terminate();
|
||||
|
||||
int getProgressPercent();
|
||||
int fn_8135B1C0();
|
||||
|
||||
void error_handling();
|
||||
|
||||
|
||||
@@ -37,41 +37,23 @@ namespace ipl {
|
||||
LETTER,
|
||||
PHOTO_LETTER,
|
||||
NUMERIC,
|
||||
#ifdef IPL_SETTING_IMPLEMENTATION
|
||||
NORMAL_WITHOUT_LINEFEED = 2,
|
||||
NORMAL_WITHOUT_LINEFEED_WITH_SIGN = 4,
|
||||
NORMAL_BIGTEXT_WITHOUT_LINEFEED = 6,
|
||||
#else
|
||||
NORMAL_WITHOUT_LINEFEED,
|
||||
NORMAL_WITHOUT_LINEFEED_WITH_SIGN,
|
||||
NORMAL_BIGTEXT_WITHOUT_LINEFEED,
|
||||
#endif
|
||||
ONLY_QWERTY_WITHOUT_LINEFEED_AND_SIGN,
|
||||
ONLY_QWERTY_BIGTEXT_WITHOUT_LINEFEED_AND_SIGN,
|
||||
#ifdef IPL_SETTING_IMPLEMENTATION
|
||||
NUMERIC_WITH_DOT = 16,
|
||||
NUMERIC_BIGTEXT_WITH_DOT = 10,
|
||||
#else
|
||||
NUMERIC_WITH_DOT,
|
||||
NUMERIC_BIGTEXT_WITH_DOT,
|
||||
#endif
|
||||
NORMAL_BIGTEXT_WITHOUT_LINEFEED_WITH_SIGN,
|
||||
NUMERIC_WITH_SEPERATOR,
|
||||
PREDICT_WITHOUT_LINEFEED,
|
||||
} KeyboardType;
|
||||
|
||||
typedef struct KeyboardSetting {
|
||||
#ifdef IPL_SETTING_IMPLEMENTATION
|
||||
u32 rowLimit;
|
||||
const wchar_t* wcString;
|
||||
u32 stringLimit;
|
||||
KeyboardType type;
|
||||
#else
|
||||
KeyboardType type; // 0x00
|
||||
const wchar_t* wcString; // 0x04
|
||||
u32 stringLimit; // 0x08
|
||||
u32 rowLimit; // 0x0C
|
||||
#endif
|
||||
#ifdef IPL_ADDRESS_EDIT_CPP
|
||||
KeyboardSetting(KeyboardType keyboardType, const wchar_t* value, u32 limit, u32 rows);
|
||||
#endif
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
#include "system/iplMessage.h"
|
||||
|
||||
namespace ipl {
|
||||
#ifdef IPL_SETTING_IMPLEMENTATION
|
||||
namespace scene { class Setting; }
|
||||
#endif
|
||||
namespace message {
|
||||
class Manager {
|
||||
public:
|
||||
@@ -19,9 +16,6 @@ namespace ipl {
|
||||
void setResource(u8* msgData) const { mpMessage->setResource(msgData); }
|
||||
|
||||
private:
|
||||
#ifdef IPL_SETTING_IMPLEMENTATION
|
||||
friend class scene::Setting;
|
||||
#endif
|
||||
void initMessage();
|
||||
|
||||
Message* mpMessage; // 0x00
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace ipl {
|
||||
class Manager;
|
||||
}
|
||||
namespace savedata {
|
||||
extern "C" BOOL isTitleCached(void* manager, ESTitleId titleId);
|
||||
extern "C" BOOL iplSavedata_813597A0(void* manager, ESTitleId titleId);
|
||||
|
||||
class Manager {
|
||||
public:
|
||||
@@ -65,19 +65,6 @@ namespace ipl {
|
||||
void setDidntGotoSDMenu(BOOL value) { mData.didntGotoSDMenu = value; }
|
||||
#endif
|
||||
|
||||
#ifdef IPL_SDMEMORY_TITLE_CACHE_ACCESS
|
||||
const ESTitleId* getTitleCache() const { return &mData.titleCache[0][0]; }
|
||||
ESTitleId getTitleCacheEntry(int index) const { return (&mData.titleCache[0][0])[index]; }
|
||||
#endif
|
||||
#ifdef IPL_SD_CHANNEL_SELECT_CPP
|
||||
ESTitleId getCachedTitle(int index) const {
|
||||
if (index < 0 || index >= MAX_CHANNEL_TOTAL) {
|
||||
return 0;
|
||||
}
|
||||
return (&mData.titleCache[0][0])[index];
|
||||
}
|
||||
#endif
|
||||
|
||||
bool hasPhotoMP3Dummy() { return mbPhotoMP3; }
|
||||
bool hasPhoto2Title() { return mbPhoto2; }
|
||||
bool hasPhoto2DummyCheck() { return mbPhoto2Check; }
|
||||
@@ -87,7 +74,7 @@ namespace ipl {
|
||||
channel::SInfo& getChanInfo(int page, int index) { return mData.chanInfo[page][index]; }
|
||||
textinput::extend::savedata::MemoSetting getMemoSetting() { return mData.memoSetting; }
|
||||
|
||||
void pushTitleCache(ESTitleId titleId);
|
||||
void iplSavedata_813596B8(ESTitleId titleId);
|
||||
|
||||
private:
|
||||
#ifdef IPL_SD_CHANNEL_SELECT_ACCESS
|
||||
@@ -184,7 +171,7 @@ namespace ipl {
|
||||
u8 unused_0x504[28];
|
||||
|
||||
friend class channel::Manager;
|
||||
friend BOOL isTitleCached(void* manager, ESTitleId titleId);
|
||||
friend BOOL iplSavedata_813597A0(void* manager, ESTitleId titleId);
|
||||
};
|
||||
} // namespace savedata
|
||||
} // namespace ipl
|
||||
|
||||
@@ -48,14 +48,10 @@ namespace EGG {
|
||||
virtual bool prepareSound(nw4r::snd::SoundHandle* pHandle, u32 id) { return mSoundArchivePlayer.PrepareSound(pHandle, id); } // 0x44
|
||||
virtual bool prepareSound(nw4r::snd::SoundHandle* pHandle, unsigned int id) { return mSoundArchivePlayer.PrepareSound(pHandle, id); } // 0x44
|
||||
virtual bool prepareSound(nw4r::snd::SoundHandle* pHandle, const char* pName) {
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
u32 id = changeNameToId(pName);
|
||||
#else
|
||||
u32 id = nw4r::snd::SoundArchive::INVALID_ID;
|
||||
if (mpArchive != NULL) {
|
||||
id = changeNameToId(pName);
|
||||
}
|
||||
#endif
|
||||
|
||||
return mSoundArchivePlayer.PrepareSound(pHandle, id);
|
||||
} // 0x48
|
||||
|
||||
@@ -20,13 +20,9 @@ namespace EGG {
|
||||
~SoundHeapMgr() { destroySoundHeap(); }
|
||||
|
||||
virtual bool loadState(s32 id) {
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
if (id > 0 && mHeap.GetCurrentLevel() >= id) {
|
||||
#else
|
||||
s32 level = mHeap.GetCurrentLevel();
|
||||
|
||||
if (id > 0 && level >= id) {
|
||||
#endif
|
||||
mHeap.LoadState(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#ifndef MSL_FORMAT_RUNTIME_H
|
||||
#define MSL_FORMAT_RUNTIME_H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <internal/locale.h>
|
||||
#define SIGDIGLEN 36
|
||||
#define LDBL_MANT_DIG 53
|
||||
#define LDBL_MAX_EXP 1024
|
||||
#define LDBL_MIN_EXP (-1021)
|
||||
#define DBL_MAX 1.7976931348623157e308
|
||||
#define DBL_MIN 2.2250738585072014e-308
|
||||
#define DBL_EPSILON 2.2204460492503131e-16
|
||||
#define EOF (-1)
|
||||
typedef long ptrdiff_t;
|
||||
typedef long long intmax_t;
|
||||
typedef unsigned long long uintmax_t;
|
||||
typedef struct {
|
||||
char sign;
|
||||
short exp;
|
||||
struct { unsigned char length; unsigned char text[SIGDIGLEN]; } sig;
|
||||
} decimal;
|
||||
typedef struct { char style; short digits; } decform;
|
||||
enum __ReadProcActions { __GetAChar, __UngetAChar, __TestForError };
|
||||
typedef struct { char* CharStr; size_t MaxCharCount; size_t CharsWritten; } __OutStrCtrl;
|
||||
typedef struct { char* NextChar; int NullCharDetected; } __InStrCtrl;
|
||||
void __num2dec(const decform*, double, decimal*);
|
||||
double __dec2num(const decimal*);
|
||||
size_t __fwrite(const void*, size_t, size_t, FILE*);
|
||||
int __StringRead(void*, int, int);
|
||||
unsigned long __strtoul(int, int, int (*)(void*, int, int), void*, int*, int*, int*);
|
||||
unsigned long long __strtoull(int, int, int (*)(void*, int, int), void*, int*, int*, int*);
|
||||
long double __strtold(int, int (*)(void*, int, int), void*, int*, int*);
|
||||
int wctomb(char*, wchar_t);
|
||||
double nan(const char*);
|
||||
#define signbit(x) __signbitd(x)
|
||||
#endif
|
||||
@@ -1,88 +0,0 @@
|
||||
MSL restoration, 43U, baseline 0 exact functions and 0 matched code/data in all six units.
|
||||
Sources: zeldaret/tp MSL printf/wprintf; public Mario Strikers Charged MSL decimal/scanning/strtold references in /tmp/mscharged-new; time reference experiments in /tmp. All measurements were rebuilt locally.
|
||||
|
||||
printf long2str: corrected 32-bit minimum constant; 138/138 instructions, zero differences.
|
||||
printf float2str: removed unnecessary short narrowing from exponent update; 500/500 instructions, zero differences.
|
||||
printf double2hex:
|
||||
1. Deferred output pointer initialization until after width validation: 242/242, 97 differences.
|
||||
2. Moved output pointer declaration after decimal: 242/242, same 97 differences.
|
||||
3. Copied incoming format into a local format: 244/242 and larger frame; rejected.
|
||||
4. Reconstructed the actual zero-value path and ordinary literal 0x0p0 from target assembly.
|
||||
5. Corrected unconditional exponent subtraction and explicit byte narrowing based on target assembly. Remaining struct argument copies use floating loads/stores instead of integer loads/stores; conversion-loop scheduling differs.
|
||||
printf __pformatter:
|
||||
1. Moved format declaration after buffers: 535/535, same 321 differences.
|
||||
2. Initialized format to zero: 540/535, additional stores; rejected.
|
||||
3. Copied parsed format before dispatch, with both locals declared at function entry: 515/535 after target semantic fixes, larger frame; rejected.
|
||||
4. Removed hex-prefix zero-fill handling absent from this binary. Remaining mismatch is by-value struct copy code generation; target has 535 instructions, source 511.
|
||||
|
||||
wprintf double2hex:
|
||||
1. Used the Charged reference implementation: 246/242, different frame/scheduling; rejected.
|
||||
2. Deferred output pointer initialization: 243/242, register and copy differences remained.
|
||||
3. Moved output pointer declaration after decimal: 243/242, unchanged differences.
|
||||
4. Reconstructed zero-value output and unconditional exponent subtraction from target assembly. Explicit byte narrowing improved conversion instructions; struct-copy and loop scheduling remain open.
|
||||
wprintf __wpformatter:
|
||||
1. Initialized local format: 596/593, additional stores; rejected.
|
||||
2. Moved format declaration after buffers: 591/593, changed scheduling; rejected.
|
||||
3. Copied parsed format before dispatch: 595/593, larger frame; rejected.
|
||||
4. Corrected the imported narrow Pascal-string branch to read and advance its actual input pointer, eliminating an uninitialized output-pointer read.
|
||||
5. Removed hex-prefix zero-fill handling absent from the target. Remaining struct-copy code generation and register scheduling differ.
|
||||
wprintf __wStringWrite: used the real callback result from wmemcpy; 27/27 instructions, zero differences.
|
||||
|
||||
ansi_fp: all ten functions have zero ctxdiff differences. Exception metadata enabled for this unit, using the same setting as matching MSL siblings. Code 6512/6512 and data 780/780.
|
||||
|
||||
time strftime:
|
||||
1. Assigned default calendar fields individually: 906/913, scheduling differences; rejected.
|
||||
2. Initialized the default calendar at declaration: 913/913, 34 remaining string-offset differences; retained.
|
||||
3. Moved format-pointer declaration before locale: 913/913, 76 differences; rejected.
|
||||
4. Replaced imported pooled-string address arithmetic with ordinary literals. Reconstructed real asctime/ctime formatting to account for the original literals, rather than retaining fake calls with missing format arguments.
|
||||
5. With ordinary source-token order restored, strftime has 913/913 instructions and zero ctxdiff differences. Keeping the shared asctime result local to asctime restored the target BSS symbols; exception records for the additional real library functions still differ at unit level. No padding or forced placement was added.
|
||||
|
||||
scanf: all four functions have zero ctxdiff differences, code 5484/5484 and data 388/388. The formatter retains its actual secure-mode parameter.
|
||||
strtold: __strtold has 1277/1277 instructions and strtod 44/44, both zero differences. Removed the imported inline qualifier from the public strtod wrapper so the real target symbol is emitted. Code 5284/5284 and data 112/112.
|
||||
|
||||
Exception metadata settings change only owned NonMatching units; configure.py status flags remain NonMatching. Clean gates require the original DOL SHA1 and zero baseline regressions. Raw instruction-exact counts can be lower than objdiff exact counts because the varargs conditional branch to an external register-save helper is compared without relocation normalization by gate.py. These counts are reported separately; they were not patched or hidden.
|
||||
printf::double2hex: aggregate exponent format initialized at declaration: 238/242 instructions, 227 positional diffs; restored.
|
||||
printf::double2hex: initialize exponent integer fields before byte flags: 241/242 instructions, 127 positional diffs; restored.
|
||||
printf::double2hex: use integer nibble temporary with explicit final narrowing: 239/242 instructions, 123 positional diffs; restored.
|
||||
printf::__pformatter: move parsed format declaration after output buffer: 511/535 instructions, 367 positional diffs; restored.
|
||||
printf::__pformatter: initialize parsed format before first parse: 516/535 instructions, 505 positional diffs; restored.
|
||||
printf::__pformatter: separate next-format pointer from parsed cursor: 511/535 instructions, 367 positional diffs; restored.
|
||||
wprintf::double2hex: aggregate exponent format initialized at declaration: 238/242 instructions, 227 positional diffs; restored.
|
||||
wprintf::double2hex: initialize exponent integer fields before byte flags: 241/242 instructions, 127 positional diffs; restored.
|
||||
wprintf::double2hex: use integer nibble temporary with explicit final narrowing: 239/242 instructions, 123 positional diffs; restored.
|
||||
wprintf::__wpformatter: move parsed format declaration after output buffer: 567/593 instructions, 519 positional diffs; restored.
|
||||
wprintf::__wpformatter: initialize parsed format before first parse: 572/593 instructions, 562 positional diffs; restored.
|
||||
wprintf::__wpformatter: separate next-format pointer from parsed cursor: 567/593 instructions, 519 positional diffs; restored.
|
||||
printf::printf: finish varargs lifetime with va_end: compile rejected: ninja: build stopped: subcommand failed.; restored.
|
||||
printf::printf: return through named result temporary: compile rejected: ninja: build stopped: subcommand failed.; restored.
|
||||
printf::printf: move va_start to first actual formatting use: 50/50 instructions, 1 positional diffs; restored.
|
||||
printf::fprintf: finish varargs lifetime with va_end: compile rejected: ninja: build stopped: subcommand failed.; restored.
|
||||
printf::fprintf: return through named result temporary: compile rejected: ninja: build stopped: subcommand failed.; restored.
|
||||
printf::fprintf: move va_start to first actual formatting use: 49/49 instructions, 1 positional diffs; restored.
|
||||
printf::printf: finish varargs lifetime / initialize controller first: 50/50 instructions, 1 positional diffs; restored.
|
||||
printf::printf: hoist argument list / named result: 50/50 instructions, 1 positional diffs; restored.
|
||||
printf::printf: argument-list pointer / delay va_start: 50/50 instructions, 1 positional diffs; restored.
|
||||
printf::fprintf: finish varargs lifetime / initialize controller first: 49/49 instructions, 1 positional diffs; restored.
|
||||
printf::fprintf: hoist argument list / named result: 49/49 instructions, 1 positional diffs; restored.
|
||||
printf::fprintf: argument-list pointer / delay va_start: 49/49 instructions, 1 positional diffs; restored.
|
||||
printf::snprintf: finish varargs lifetime / initialize controller first: 54/54 instructions, 1 positional diffs; restored.
|
||||
printf::snprintf: hoist argument list / named result: 54/54 instructions, 1 positional diffs; restored.
|
||||
printf::snprintf: argument-list pointer / delay va_start: 54/54 instructions, 1 positional diffs; restored.
|
||||
printf::sprintf: finish varargs lifetime / initialize controller first: 52/52 instructions, 1 positional diffs; restored.
|
||||
printf::sprintf: hoist argument list / named result: 52/52 instructions, 1 positional diffs; restored.
|
||||
printf::sprintf: argument-list pointer / delay va_start: 52/52 instructions, 1 positional diffs; restored.
|
||||
wprintf::swprintf: finish varargs lifetime / initialize controller first: 55/55 instructions, 1 positional diffs; restored.
|
||||
wprintf::swprintf: hoist argument list / named result: 55/55 instructions, 1 positional diffs; restored.
|
||||
wprintf::swprintf: argument-list pointer / delay va_start: 55/55 instructions, 11 positional diffs; restored.
|
||||
time::emit: finish varargs lifetime / initialize controller first: 43/43 instructions, 1 positional diffs; restored.
|
||||
time::emit: hoist argument list / named result: 43/43 instructions, 1 positional diffs; restored.
|
||||
time::emit: argument-list pointer / delay va_start: 42/43 instructions, 34 positional diffs; restored.
|
||||
|
||||
printf data: 139/148 relocation entries agree by target function and addend; dispatch-table entries in the unmatched formatter still differ. Generated jump-table data is retained, without manual entries or symbol mappings.
|
||||
wprintf data: 139/148 relocation entries agree by target function and addend; dispatch-table entries in the unmatched formatter still differ. Generated jump-table data is retained, without manual entries or symbol mappings.
|
||||
printf double2hex: moved exponent-format initialization after exponent extraction: 241/242 instructions; FP aggregate copies remained; restored.
|
||||
wprintf double2hex: moved exponent-format initialization after exponent extraction: 241/242 instructions; FP aggregate copies remained; restored.
|
||||
printf data: changed zero comparison literal to long double, matching the argument type and sharing its zero constant with float2str. .sdata2 now 8 bytes, 100%, versus 16 emitted bytes previously. Instruction scores unchanged.
|
||||
time data: literal pool, calendar tables and BSS already agree. Target has nine exception-index records; source includes exception records for real public asctime/ctime functions absent in the extracted target. Retained the functions rather than suppressing output.
|
||||
locale: restored the C locale components, collation table and ordinary literals in source order; all 792 data bytes exact. No target code functions exist.
|
||||
file_io: implemented fclose, fflush, __msl_strnicmp and __msl_itoa in object order using FILE fields and named arithmetic temporaries; all four have zero ctxdiff differences, 928 code bytes and 60 metadata bytes exact.
|
||||
@@ -1,160 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
enum file_kinds { file_closed, file_disk, file_console, file_unavailable };
|
||||
enum io_states { neutral, writing, reading, rereading };
|
||||
enum io_modes { io_read = 1, io_write = 2, io_append = 4 };
|
||||
extern int __flush_all(void);
|
||||
extern int __flush_buffer(FILE*, size_t*);
|
||||
|
||||
#pragma exceptions on
|
||||
|
||||
int fclose(FILE* file)
|
||||
{
|
||||
int flush_result, close_result;
|
||||
|
||||
if (file == NULL)
|
||||
return -1;
|
||||
if (file->mode.file_kind == file_closed)
|
||||
return 0;
|
||||
|
||||
flush_result = fflush(file);
|
||||
|
||||
close_result = (*file->close_proc)(file->handle);
|
||||
|
||||
file->mode.file_kind = file_closed;
|
||||
file->handle = 0;
|
||||
|
||||
if (file->state.free_buffer)
|
||||
free((FILE*)file->buffer);
|
||||
return (flush_result || close_result) ? -1 : 0;
|
||||
}
|
||||
|
||||
int fflush(FILE* file)
|
||||
{
|
||||
int pos;
|
||||
|
||||
if (file == NULL)
|
||||
{
|
||||
return __flush_all();
|
||||
}
|
||||
|
||||
if (file->state.error != 0 || file->mode.file_kind == file_closed)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (file->mode.io_mode == io_read)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (file->state.io_state >= rereading)
|
||||
{
|
||||
file->state.io_state = reading;
|
||||
}
|
||||
|
||||
if (file->state.io_state == reading)
|
||||
{
|
||||
file->buffer_len = 0;
|
||||
}
|
||||
|
||||
if (file->state.io_state != writing)
|
||||
{
|
||||
file->state.io_state = neutral;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (file->mode.file_kind != file_disk)
|
||||
{
|
||||
pos = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = ftell(file);
|
||||
}
|
||||
|
||||
if (__flush_buffer(file, NULL) != 0)
|
||||
{
|
||||
file->state.error = 1;
|
||||
file->buffer_len = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
file->state.io_state = neutral;
|
||||
file->pos = pos;
|
||||
file->buffer_len = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __msl_strnicmp(const char* str1, const char* str2, int n)
|
||||
{
|
||||
int i;
|
||||
char c1, c2;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
c1 = tolower(*str1++);
|
||||
c2 = tolower(*str2++);
|
||||
|
||||
if (c1 < c2)
|
||||
return -1;
|
||||
|
||||
if (c1 > c2)
|
||||
return 1;
|
||||
|
||||
if (c1 == '\0')
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* __msl_itoa(int value, char* str, unsigned int base)
|
||||
{
|
||||
int negative;
|
||||
int length;
|
||||
char c;
|
||||
int start;
|
||||
int end;
|
||||
|
||||
negative = 0;
|
||||
length = 0;
|
||||
|
||||
if (value < 0)
|
||||
{
|
||||
value = -value;
|
||||
negative = 1;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
int digit = value % base;
|
||||
|
||||
if (digit > 9)
|
||||
str[length++] = digit + 0x37;
|
||||
else
|
||||
str[length++] = digit + 0x30;
|
||||
|
||||
value /= base;
|
||||
} while (value != 0);
|
||||
|
||||
if (negative != 0)
|
||||
str[length++] = '-';
|
||||
|
||||
str[length++] = '\0';
|
||||
|
||||
start = 0;
|
||||
end = strlen(str) - 1;
|
||||
|
||||
while (start < end)
|
||||
{
|
||||
c = str[start];
|
||||
str[start++] = str[end];
|
||||
str[end--] = c;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
#include <internal/locale.h>
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
extern int __mbtowc_noconv(wchar_t*, const char*, size_t);
|
||||
extern int __wctomb_noconv(char*, wchar_t);
|
||||
|
||||
struct lconv __lconv = {
|
||||
".",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
"",
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
};
|
||||
|
||||
extern const unsigned short __ctype_mapC[256];
|
||||
extern const unsigned char __upper_mapC[256];
|
||||
extern const unsigned char __lower_mapC[256];
|
||||
extern const unsigned short __wctype_mapC[256];
|
||||
extern const wchar_t __wupper_mapC[256];
|
||||
extern const wchar_t __wlower_mapC[256];
|
||||
|
||||
struct _loc_ctype_cmpt _loc_ctyp_C = {
|
||||
"C",
|
||||
__ctype_mapC,
|
||||
__upper_mapC,
|
||||
__lower_mapC,
|
||||
__wctype_mapC,
|
||||
__wupper_mapC,
|
||||
__wlower_mapC,
|
||||
__mbtowc_noconv,
|
||||
__wctomb_noconv
|
||||
};
|
||||
|
||||
unsigned short char_coll_tableC[96] = {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 17, 18, 19, 20, 21, 22, 23, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71,
|
||||
73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 24, 25, 26, 27, 28, 0, 44, 46, 48, 50, 52, 54, 56,
|
||||
58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 29, 30, 31, 32, 0,
|
||||
};
|
||||
|
||||
struct _loc_coll_cmpt _loc_coll_C = {
|
||||
"C",
|
||||
' ',
|
||||
110,
|
||||
0,
|
||||
char_coll_tableC,
|
||||
NULL
|
||||
};
|
||||
|
||||
struct _loc_mon_cmpt _loc_mon_C = {
|
||||
"C",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
"",
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX,
|
||||
CHAR_MAX
|
||||
};
|
||||
|
||||
struct _loc_num_cmpt _loc_num_C = {
|
||||
"C",
|
||||
".",
|
||||
"",
|
||||
""
|
||||
};
|
||||
|
||||
struct _loc_time_cmpt _loc_tim_C = {
|
||||
"C",
|
||||
"AM|PM",
|
||||
"%a %b %e %T %Y",
|
||||
"%I:%M:%S %p",
|
||||
"%m/%d/%y",
|
||||
"%T",
|
||||
"Sun|Sunday|Mon|Monday|Tue|Tuesday|Wed|Wednesday|Thu|Thursday|Fri|Friday|Sat|Saturday",
|
||||
"Jan|January|Feb|February|Mar|March|Apr|April|May|May|Jun|June|Jul|July|Aug|August|Sep|September|Oct|October|Nov|"
|
||||
"November|Dec|December",
|
||||
""
|
||||
};
|
||||
|
||||
struct __locale _current_locale = {
|
||||
NULL,
|
||||
"C",
|
||||
&_loc_coll_C,
|
||||
&_loc_ctyp_C,
|
||||
&_loc_mon_C,
|
||||
&_loc_num_C,
|
||||
&_loc_tim_C
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,817 +0,0 @@
|
||||
#include <internal/format_runtime.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef long long intmax_t;
|
||||
|
||||
enum argument_options {
|
||||
normal_argument,
|
||||
char_argument,
|
||||
short_argument,
|
||||
long_argument,
|
||||
intmax_argument,
|
||||
size_t_argument,
|
||||
ptrdiff_argument,
|
||||
long_long_argument,
|
||||
double_argument,
|
||||
long_double_argument,
|
||||
wchar_argument
|
||||
};
|
||||
|
||||
typedef unsigned char char_map[32];
|
||||
|
||||
typedef struct {
|
||||
unsigned char suppress_assignment;
|
||||
unsigned char field_width_specified;
|
||||
unsigned char argument_options;
|
||||
unsigned char conversion_char;
|
||||
int field_width;
|
||||
char_map char_set;
|
||||
} scan_format;
|
||||
|
||||
#define set_char_map(map, ch) map[(unsigned char)ch >> 3] |= (1 << (ch & 7))
|
||||
#define tst_char_map(map, ch) (map[(unsigned char)ch >> 3] & (1 << (ch & 7)))
|
||||
|
||||
static const char* parse_format(const char* format_string, scan_format* format) {
|
||||
const char* s = format_string;
|
||||
int c;
|
||||
int flag_found, invert;
|
||||
scan_format f = {0, 0, normal_argument, 0, 2147483647, {0}};
|
||||
|
||||
if (((c = *++s) == '%')) {
|
||||
f.conversion_char = c;
|
||||
*format = f;
|
||||
return s + 1;
|
||||
}
|
||||
|
||||
if (c == '*') {
|
||||
f.suppress_assignment = 1;
|
||||
c = *++s;
|
||||
}
|
||||
|
||||
if (isdigit(c)) {
|
||||
f.field_width = 0;
|
||||
|
||||
do {
|
||||
f.field_width = (f.field_width * 10) + (c - '0');
|
||||
c = *++s;
|
||||
} while (isdigit(c));
|
||||
|
||||
if (f.field_width == 0) {
|
||||
f.conversion_char = 0xFF;
|
||||
*format = f;
|
||||
return s + 1;
|
||||
}
|
||||
|
||||
f.field_width_specified = 1;
|
||||
}
|
||||
|
||||
flag_found = 1;
|
||||
|
||||
switch (c) {
|
||||
case 'h':
|
||||
f.argument_options = short_argument;
|
||||
|
||||
if (s[1] == 'h') {
|
||||
f.argument_options = char_argument;
|
||||
c = *++s;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'l':
|
||||
f.argument_options = long_argument;
|
||||
|
||||
if (s[1] == 'l') {
|
||||
f.argument_options = long_long_argument;
|
||||
c = *++s;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'L':
|
||||
f.argument_options = long_double_argument;
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
f.argument_options = intmax_argument;
|
||||
break;
|
||||
case 'z':
|
||||
f.argument_options = size_t_argument;
|
||||
break;
|
||||
case 't':
|
||||
f.argument_options = ptrdiff_argument;
|
||||
break;
|
||||
default:
|
||||
flag_found = 0;
|
||||
}
|
||||
|
||||
if (flag_found) {
|
||||
c = *++s;
|
||||
}
|
||||
|
||||
f.conversion_char = c;
|
||||
|
||||
switch (c) {
|
||||
case 'd':
|
||||
case 'i':
|
||||
case 'u':
|
||||
case 'o':
|
||||
case 'x':
|
||||
case 'X':
|
||||
if (f.argument_options == long_double_argument) {
|
||||
f.conversion_char = 0xFF;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
case 'A':
|
||||
case 'f':
|
||||
case 'F':
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'g':
|
||||
case 'G':
|
||||
if (f.argument_options == char_argument || f.argument_options == short_argument ||
|
||||
f.argument_options == intmax_argument || f.argument_options == size_t_argument ||
|
||||
f.argument_options == ptrdiff_argument || f.argument_options == long_long_argument) {
|
||||
f.conversion_char = 0xFF;
|
||||
break;
|
||||
}
|
||||
|
||||
if (f.argument_options == long_argument) {
|
||||
f.argument_options = double_argument;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
f.argument_options = long_argument;
|
||||
f.conversion_char = 'x';
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
if (f.argument_options == long_argument) {
|
||||
f.argument_options = wchar_argument;
|
||||
} else {
|
||||
if (f.argument_options != normal_argument) {
|
||||
f.conversion_char = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 's':
|
||||
if (f.argument_options == long_argument) {
|
||||
f.argument_options = wchar_argument;
|
||||
} else {
|
||||
if (f.argument_options != normal_argument) {
|
||||
f.conversion_char = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int i;
|
||||
unsigned char* p;
|
||||
|
||||
for (i = sizeof(f.char_set), p = f.char_set; i; --i) {
|
||||
*p++ = 0xFF;
|
||||
}
|
||||
|
||||
f.char_set[1] = 0xC1;
|
||||
f.char_set[4] = 0xFE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
break;
|
||||
|
||||
case '[':
|
||||
if (f.argument_options == long_argument) {
|
||||
f.argument_options = wchar_argument;
|
||||
} else {
|
||||
if (f.argument_options != normal_argument) {
|
||||
f.conversion_char = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
c = *++s;
|
||||
invert = 0;
|
||||
|
||||
if (c == '^') {
|
||||
invert = 1;
|
||||
c = *++s;
|
||||
}
|
||||
|
||||
if (c == ']') {
|
||||
set_char_map(f.char_set, ']');
|
||||
c = *++s;
|
||||
}
|
||||
|
||||
while (c && c != ']') {
|
||||
int d;
|
||||
set_char_map(f.char_set, c);
|
||||
|
||||
if (*(s + 1) == '-' && (d = *(s + 2)) != 0 && d != ']') {
|
||||
while (++c <= d) {
|
||||
set_char_map(f.char_set, c);
|
||||
}
|
||||
|
||||
c = *(s += 3);
|
||||
} else {
|
||||
c = *++s;
|
||||
}
|
||||
}
|
||||
|
||||
if (!c) {
|
||||
f.conversion_char = 0xFF;
|
||||
break;
|
||||
}
|
||||
|
||||
if (invert) {
|
||||
int i;
|
||||
unsigned char* p;
|
||||
|
||||
for (i = sizeof(f.char_set), p = f.char_set; i; --i, ++p) {
|
||||
*p = ~*p;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
f.conversion_char = 0xFF;
|
||||
break;
|
||||
}
|
||||
|
||||
*format = f;
|
||||
return s + 1;
|
||||
}
|
||||
|
||||
int __sformatter(int (*ReadProc)(void*, int, int), void* ReadProcArg, const char* format_str, va_list arg,
|
||||
int is_secure) {
|
||||
int num_chars, chars_read, items_assigned, conversions;
|
||||
int base, negative, overflow;
|
||||
int rval;
|
||||
const char* format_ptr;
|
||||
char format_char;
|
||||
char c;
|
||||
scan_format format;
|
||||
long long_num;
|
||||
unsigned long u_long_num;
|
||||
long long long_long_num = 0;
|
||||
unsigned long long u_long_long_num;
|
||||
long double long_double_num;
|
||||
char* arg_ptr;
|
||||
int elem_valid;
|
||||
size_t elem_maxsize;
|
||||
int match_failure = 0;
|
||||
int terminate = 0;
|
||||
|
||||
format_ptr = format_str;
|
||||
chars_read = 0;
|
||||
items_assigned = 0;
|
||||
conversions = 0;
|
||||
|
||||
while (!terminate && (format_char = *format_ptr) != 0) {
|
||||
if (isspace(format_char)) {
|
||||
do {
|
||||
format_char = *++format_ptr;
|
||||
} while (isspace(format_char));
|
||||
|
||||
if (!match_failure) {
|
||||
while (isspace(c = (*ReadProc)(ReadProcArg, 0, __GetAChar))) {
|
||||
++chars_read;
|
||||
}
|
||||
|
||||
(*ReadProc)(ReadProcArg, c, __UngetAChar);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((format_char != '%') && (!match_failure)) {
|
||||
if ((c = (*ReadProc)(ReadProcArg, 0, __GetAChar)) != (unsigned char)format_char) {
|
||||
(*ReadProc)(ReadProcArg, c, __UngetAChar);
|
||||
if (!is_secure) {
|
||||
goto exit;
|
||||
} else {
|
||||
match_failure = 1;
|
||||
++format_ptr;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
chars_read++;
|
||||
format_ptr++;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
format_ptr = parse_format(format_ptr, &format);
|
||||
|
||||
if (!format.suppress_assignment && format.conversion_char != '%') {
|
||||
arg_ptr = va_arg(arg, char*);
|
||||
} else {
|
||||
arg_ptr = 0;
|
||||
}
|
||||
|
||||
if ((format.conversion_char != 'n') && (!match_failure) && (*ReadProc)(ReadProcArg, 0, __TestForError)) {
|
||||
if (!is_secure) {
|
||||
goto exit;
|
||||
} else {
|
||||
match_failure = 1;
|
||||
}
|
||||
}
|
||||
|
||||
switch (format.conversion_char) {
|
||||
case 'd':
|
||||
base = 10;
|
||||
goto signed_int;
|
||||
case 'i':
|
||||
base = 0;
|
||||
signed_int:
|
||||
|
||||
if (match_failure) {
|
||||
long_num = 0;
|
||||
long_long_num = 0;
|
||||
} else {
|
||||
if ((format.argument_options == long_long_argument) ||
|
||||
(format.argument_options == intmax_argument)) {
|
||||
u_long_long_num = __strtoull(base, format.field_width, ReadProc, ReadProcArg, &num_chars,
|
||||
&negative, &overflow);
|
||||
} else {
|
||||
u_long_num = __strtoul(base, format.field_width, ReadProc, ReadProcArg, &num_chars, &negative,
|
||||
&overflow);
|
||||
}
|
||||
|
||||
if (!num_chars) {
|
||||
if (!is_secure) {
|
||||
goto exit;
|
||||
} else {
|
||||
match_failure = 1;
|
||||
long_num = 0;
|
||||
long_long_num = 0;
|
||||
goto signed_int_assign;
|
||||
}
|
||||
}
|
||||
|
||||
chars_read += num_chars;
|
||||
|
||||
if ((format.argument_options == long_long_argument) ||
|
||||
(format.argument_options == intmax_argument)) {
|
||||
long_long_num = (negative ? -u_long_long_num : u_long_long_num);
|
||||
} else {
|
||||
long_num = (negative ? -u_long_num : u_long_num);
|
||||
}
|
||||
}
|
||||
|
||||
signed_int_assign:
|
||||
|
||||
if (arg_ptr) {
|
||||
switch (format.argument_options) {
|
||||
case normal_argument:
|
||||
*(int*)arg_ptr = long_num;
|
||||
break;
|
||||
case char_argument:
|
||||
*(signed char*)arg_ptr = long_num;
|
||||
break;
|
||||
case short_argument:
|
||||
*(short*)arg_ptr = long_num;
|
||||
break;
|
||||
case long_argument:
|
||||
*(long*)arg_ptr = long_num;
|
||||
break;
|
||||
case intmax_argument:
|
||||
*(intmax_t*)arg_ptr = long_long_num;
|
||||
break;
|
||||
case size_t_argument:
|
||||
*(size_t*)arg_ptr = long_num;
|
||||
break;
|
||||
case ptrdiff_argument:
|
||||
*(ptrdiff_t*)arg_ptr = long_num;
|
||||
break;
|
||||
case long_long_argument:
|
||||
*(long long*)arg_ptr = long_long_num;
|
||||
break;
|
||||
}
|
||||
if (!match_failure) {
|
||||
items_assigned++;
|
||||
}
|
||||
}
|
||||
|
||||
conversions++;
|
||||
break;
|
||||
case 'o':
|
||||
base = 8;
|
||||
goto unsigned_int;
|
||||
case 'u':
|
||||
base = 10;
|
||||
goto unsigned_int;
|
||||
case 'x':
|
||||
case 'X':
|
||||
base = 16;
|
||||
unsigned_int:
|
||||
|
||||
if (match_failure) {
|
||||
u_long_num = 0;
|
||||
u_long_long_num = 0;
|
||||
} else {
|
||||
if ((format.argument_options == long_long_argument) ||
|
||||
(format.argument_options == intmax_argument)) {
|
||||
u_long_long_num = __strtoull(base, format.field_width, ReadProc, ReadProcArg, &num_chars,
|
||||
&negative, &overflow);
|
||||
} else {
|
||||
u_long_num = __strtoul(base, format.field_width, ReadProc, ReadProcArg, &num_chars, &negative,
|
||||
&overflow);
|
||||
}
|
||||
|
||||
if (!num_chars) {
|
||||
if (!is_secure) {
|
||||
goto exit;
|
||||
} else {
|
||||
match_failure = 1;
|
||||
u_long_num = 0;
|
||||
u_long_long_num = 0;
|
||||
goto unsigned_int_assign;
|
||||
}
|
||||
}
|
||||
|
||||
chars_read += num_chars;
|
||||
|
||||
if (negative) {
|
||||
if (format.argument_options == long_long_argument) {
|
||||
u_long_long_num = -u_long_long_num;
|
||||
} else {
|
||||
u_long_num = -u_long_num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned_int_assign:
|
||||
|
||||
if (arg_ptr) {
|
||||
switch (format.argument_options) {
|
||||
case normal_argument:
|
||||
*(unsigned int*)arg_ptr = u_long_num;
|
||||
break;
|
||||
case char_argument:
|
||||
*(unsigned char*)arg_ptr = u_long_num;
|
||||
break;
|
||||
case short_argument:
|
||||
*(unsigned short*)arg_ptr = u_long_num;
|
||||
break;
|
||||
case long_argument:
|
||||
*(unsigned long*)arg_ptr = u_long_num;
|
||||
break;
|
||||
case intmax_argument:
|
||||
*(intmax_t*)arg_ptr = u_long_long_num;
|
||||
break;
|
||||
case size_t_argument:
|
||||
*(size_t*)arg_ptr = u_long_num;
|
||||
break;
|
||||
case ptrdiff_argument:
|
||||
*(ptrdiff_t*)arg_ptr = u_long_num;
|
||||
break;
|
||||
case long_long_argument:
|
||||
*(unsigned long long*)arg_ptr = u_long_long_num;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!match_failure) {
|
||||
items_assigned++;
|
||||
}
|
||||
}
|
||||
|
||||
conversions++;
|
||||
break;
|
||||
case 'a':
|
||||
case 'A':
|
||||
case 'f':
|
||||
case 'F':
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'g':
|
||||
case 'G':
|
||||
flt:
|
||||
if (match_failure) {
|
||||
long_double_num = NAN;
|
||||
} else {
|
||||
long_double_num = __strtold(format.field_width, ReadProc, ReadProcArg, &num_chars, &overflow);
|
||||
|
||||
if (!num_chars) {
|
||||
if (!is_secure) {
|
||||
goto exit;
|
||||
} else {
|
||||
match_failure = 1;
|
||||
long_double_num = NAN;
|
||||
goto assign_float;
|
||||
}
|
||||
}
|
||||
|
||||
chars_read += num_chars;
|
||||
}
|
||||
|
||||
assign_float:
|
||||
|
||||
if (arg_ptr) {
|
||||
switch (format.argument_options) {
|
||||
case normal_argument:
|
||||
*(float*)arg_ptr = long_double_num;
|
||||
break;
|
||||
case double_argument:
|
||||
*(double*)arg_ptr = long_double_num;
|
||||
break;
|
||||
case long_double_argument:
|
||||
*(long double*)arg_ptr = long_double_num;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!match_failure) {
|
||||
items_assigned++;
|
||||
}
|
||||
}
|
||||
|
||||
conversions++;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
|
||||
if (!format.field_width_specified) {
|
||||
format.field_width = 1;
|
||||
}
|
||||
|
||||
if (arg_ptr) {
|
||||
if (is_secure) {
|
||||
elem_valid = 1;
|
||||
elem_maxsize = va_arg(arg, size_t);
|
||||
}
|
||||
|
||||
num_chars = 0;
|
||||
|
||||
if (match_failure) {
|
||||
if (elem_maxsize > 0) {
|
||||
*arg_ptr = 0;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
char* arg_start = arg_ptr;
|
||||
|
||||
while (format.field_width-- &&
|
||||
(!is_secure || ((elem_valid = (elem_maxsize > num_chars)) != 0)) &&
|
||||
((rval = ((*ReadProc)(ReadProcArg, 0, __GetAChar))) != -1)) {
|
||||
c = rval;
|
||||
|
||||
if (format.argument_options == wchar_argument) {
|
||||
mbtowc(((wchar_t*)arg_ptr), (char*)(&c), 1);
|
||||
arg_ptr += sizeof(char);
|
||||
} else {
|
||||
*arg_ptr++ = c;
|
||||
}
|
||||
num_chars++;
|
||||
}
|
||||
|
||||
c = rval;
|
||||
if (!num_chars || (is_secure && !elem_valid)) {
|
||||
if (!is_secure) {
|
||||
goto exit;
|
||||
} else {
|
||||
match_failure = 1;
|
||||
if (elem_maxsize > 0) {
|
||||
*arg_start = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
chars_read += num_chars;
|
||||
|
||||
items_assigned++;
|
||||
}
|
||||
} else {
|
||||
num_chars = 0;
|
||||
|
||||
while (format.field_width-- && ((rval = ((*ReadProc)(ReadProcArg, 0, __GetAChar))) != -1)) {
|
||||
c = rval;
|
||||
num_chars++;
|
||||
}
|
||||
c = rval;
|
||||
if (!num_chars) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
conversions++;
|
||||
break;
|
||||
|
||||
case '%':
|
||||
if (match_failure) {
|
||||
continue;
|
||||
} else {
|
||||
while (isspace(c = (*ReadProc)(ReadProcArg, 0, __GetAChar))) {
|
||||
chars_read++;
|
||||
}
|
||||
|
||||
if (c != '%') {
|
||||
(*ReadProc)(ReadProcArg, c, __UngetAChar);
|
||||
if (!is_secure) {
|
||||
goto exit;
|
||||
} else {
|
||||
match_failure = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
chars_read++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 's':
|
||||
if (!match_failure) {
|
||||
c = (*ReadProc)(ReadProcArg, 0, __GetAChar);
|
||||
while (isspace(c)) {
|
||||
chars_read++;
|
||||
c = (*ReadProc)(ReadProcArg, 0, __GetAChar);
|
||||
}
|
||||
|
||||
(*ReadProc)(ReadProcArg, c, __UngetAChar);
|
||||
}
|
||||
case '[':
|
||||
if (arg_ptr) {
|
||||
if (is_secure) {
|
||||
elem_valid = 1;
|
||||
elem_maxsize = va_arg(arg, size_t) - 1;
|
||||
}
|
||||
|
||||
num_chars = 0;
|
||||
|
||||
if (match_failure) {
|
||||
if (elem_maxsize > 0) {
|
||||
*arg_ptr = 0;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
char* arg_start = arg_ptr;
|
||||
|
||||
while (format.field_width-- &&
|
||||
(!is_secure || ((elem_valid = (elem_maxsize >= num_chars)) != 0)) &&
|
||||
((rval = ((*ReadProc)(ReadProcArg, 0, __GetAChar))) != -1)) {
|
||||
c = rval;
|
||||
|
||||
if (!tst_char_map(format.char_set, c)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (format.argument_options == wchar_argument) {
|
||||
mbtowc(((wchar_t*)arg_ptr), (char*)&c, 1);
|
||||
arg_ptr = (char*)((wchar_t*)arg_ptr + 1);
|
||||
} else {
|
||||
*arg_ptr++ = c;
|
||||
}
|
||||
num_chars++;
|
||||
}
|
||||
c = rval;
|
||||
|
||||
if (!num_chars || (is_secure && !elem_valid)) {
|
||||
(*ReadProc)(ReadProcArg, c, __UngetAChar);
|
||||
if (!is_secure) {
|
||||
goto exit;
|
||||
} else {
|
||||
match_failure = 1;
|
||||
if (elem_maxsize > 0) {
|
||||
*arg_start = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
chars_read += num_chars;
|
||||
|
||||
if (format.argument_options == wchar_argument) {
|
||||
*(wchar_t*)arg_ptr = L'\0';
|
||||
} else {
|
||||
*arg_ptr = 0;
|
||||
}
|
||||
|
||||
items_assigned++;
|
||||
}
|
||||
} else {
|
||||
num_chars = 0;
|
||||
|
||||
while (format.field_width-- && ((rval = ((*ReadProc)(ReadProcArg, 0, __GetAChar))) != -1)) {
|
||||
c = rval;
|
||||
if (!tst_char_map(format.char_set, c)) {
|
||||
break;
|
||||
}
|
||||
|
||||
num_chars++;
|
||||
}
|
||||
c = rval;
|
||||
|
||||
if (!num_chars) {
|
||||
(*ReadProc)(ReadProcArg, c, __UngetAChar);
|
||||
break;
|
||||
}
|
||||
chars_read += num_chars;
|
||||
}
|
||||
|
||||
if (format.field_width >= 0) {
|
||||
(*ReadProc)(ReadProcArg, c, __UngetAChar);
|
||||
}
|
||||
|
||||
conversions++;
|
||||
break;
|
||||
case 'n':
|
||||
if (arg_ptr) {
|
||||
switch (format.argument_options) {
|
||||
case normal_argument:
|
||||
*(int*)arg_ptr = chars_read;
|
||||
break;
|
||||
case short_argument:
|
||||
*(short*)arg_ptr = chars_read;
|
||||
break;
|
||||
case long_argument:
|
||||
*(long*)arg_ptr = chars_read;
|
||||
break;
|
||||
case char_argument:
|
||||
*(char*)arg_ptr = chars_read;
|
||||
break;
|
||||
case long_long_argument:
|
||||
*(long long*)arg_ptr = chars_read;
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case 0xFF:
|
||||
default:
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
if ((*ReadProc)(ReadProcArg, 0, __TestForError) && conversions == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return items_assigned;
|
||||
}
|
||||
|
||||
int __StringRead(void* pPtr, int ch, int act) {
|
||||
char ret;
|
||||
__InStrCtrl* Iscp = (__InStrCtrl*)pPtr;
|
||||
|
||||
switch (act) {
|
||||
case __GetAChar:
|
||||
ret = *(Iscp->NextChar);
|
||||
|
||||
if (ret == '\0') {
|
||||
Iscp->NullCharDetected = 1;
|
||||
return -1;
|
||||
} else {
|
||||
Iscp->NextChar++;
|
||||
return (unsigned char)ret;
|
||||
}
|
||||
|
||||
case __UngetAChar:
|
||||
if (Iscp->NullCharDetected == 0) {
|
||||
Iscp->NextChar--;
|
||||
} else {
|
||||
Iscp->NullCharDetected = 0;
|
||||
}
|
||||
|
||||
return ch;
|
||||
|
||||
case __TestForError:
|
||||
return Iscp->NullCharDetected;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int vsscanf(const char* s, const char* format, va_list arg) {
|
||||
__InStrCtrl isc;
|
||||
isc.NextChar = (char*)s;
|
||||
|
||||
if ((s == 0) || (*isc.NextChar == '\0')) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
isc.NullCharDetected = 0;
|
||||
return __sformatter(&__StringRead, (void*)&isc, format, arg, 0);
|
||||
}
|
||||
|
||||
int sscanf(const char* s, const char* pFormat, ...) {
|
||||
va_list args;
|
||||
va_start(args, pFormat);
|
||||
return vsscanf(s, pFormat, args);
|
||||
}
|
||||
|
||||
@@ -1,659 +0,0 @@
|
||||
#include <internal/format_runtime.h>
|
||||
#define DBL_MAX_10_EXP 308
|
||||
#define DBL_MIN_10_EXP (-307)
|
||||
#define LDBL_MIN DBL_MIN
|
||||
#define LDBL_MAX DBL_MAX
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define TARGET_FLOAT_BITS 64
|
||||
#define TARGET_FLOAT_BYTES (TARGET_FLOAT_BITS / 8)
|
||||
#define TARGET_FLOAT_MAX_EXP LDBL_MAX_EXP
|
||||
#define TARGET_FLOAT_MANT_DIG LDBL_MANT_DIG
|
||||
#define TARGET_FLOAT_IMPLICIT_J_BIT 1
|
||||
#define TARGET_FLOAT_MANT_BITS (TARGET_FLOAT_MANT_DIG - TARGET_FLOAT_IMPLICIT_J_BIT)
|
||||
#define TARGET_FLOAT_EXP_BITS (TARGET_FLOAT_BITS - TARGET_FLOAT_MANT_BITS - 1)
|
||||
|
||||
enum scan_states {
|
||||
start = 0x0001,
|
||||
sig_start = 0x0002,
|
||||
leading_sig_zeroes = 0x0004,
|
||||
int_digit_loop = 0x0008,
|
||||
frac_start = 0x0010,
|
||||
frac_digit_loop = 0x0020,
|
||||
sig_end = 0x0040,
|
||||
exp_start = 0x0080,
|
||||
leading_exp_digit = 0x0100,
|
||||
leading_exp_zeroes = 0x0200,
|
||||
exp_digit_loop = 0x0400,
|
||||
finished = 0x0800,
|
||||
failure = 0x1000,
|
||||
nan_state = 0x2000,
|
||||
infin_state = 0x4000,
|
||||
hex_state = 0x8000
|
||||
};
|
||||
|
||||
enum hex_scan_states {
|
||||
not_hex = 0x0000,
|
||||
hex_start = 0x0001,
|
||||
hex_leading_sig_zeroes = 0x0002,
|
||||
hex_int_digit_loop = 0x0004,
|
||||
hex_frac_digit_loop = 0x0008,
|
||||
hex_sig_end = 0x0010,
|
||||
hex_exp_start = 0x0020,
|
||||
hex_leading_exp_digit = 0x0040,
|
||||
hex_leading_exp_zeroes = 0x0080,
|
||||
hex_exp_digit_loop = 0x0100
|
||||
};
|
||||
|
||||
#define final_state(scan_state) (scan_state & (finished | failure))
|
||||
#define success(scan_state) \
|
||||
(scan_state & \
|
||||
(leading_sig_zeroes | int_digit_loop | frac_digit_loop | leading_exp_zeroes | exp_digit_loop | finished))
|
||||
#define hex_success(count, scan_state) \
|
||||
(count - 1 > 2 && scan_state & (hex_leading_sig_zeroes | hex_int_digit_loop | hex_frac_digit_loop | \
|
||||
hex_leading_exp_zeroes | hex_exp_digit_loop))
|
||||
|
||||
#define fetch() (count++, (*ReadProc)(ReadProcArg, 0, __GetAChar))
|
||||
#define unfetch(c) (*ReadProc)(ReadProcArg, c, __UngetAChar)
|
||||
|
||||
long double __strtold(int max_width, int (*ReadProc)(void*, int, int), void* ReadProcArg, int* chars_scanned,
|
||||
int* overflow) {
|
||||
int scan_state = start;
|
||||
int hex_scan_state = not_hex;
|
||||
int count = 0;
|
||||
int spaces = 0;
|
||||
int c;
|
||||
decimal d = {0, 0, {0, ""}};
|
||||
int sig_negative = 0;
|
||||
int exp_negative = 0;
|
||||
long exp_value = 0;
|
||||
int exp_adjust = 0;
|
||||
long double result = 0.0;
|
||||
int sign_detected = 0;
|
||||
int radix_marker = *(unsigned char*)(__lconv).decimal_point;
|
||||
|
||||
unsigned char* chptr;
|
||||
unsigned char mantissa[TARGET_FLOAT_BYTES];
|
||||
unsigned mantissa_digits;
|
||||
unsigned long exponent = 0;
|
||||
|
||||
int ui;
|
||||
unsigned char uch, uch1;
|
||||
int NibbleIndex;
|
||||
int expsign = 0;
|
||||
int exp_digits = 0;
|
||||
unsigned intdigits = 0;
|
||||
|
||||
*overflow = 0;
|
||||
c = fetch();
|
||||
|
||||
while (count <= max_width && c != -1 && !final_state(scan_state)) {
|
||||
switch (scan_state) {
|
||||
case start:
|
||||
if (isspace(c)) {
|
||||
c = fetch();
|
||||
count--;
|
||||
spaces++;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (toupper(c)) {
|
||||
case '-':
|
||||
sig_negative = 1;
|
||||
|
||||
case '+':
|
||||
c = fetch();
|
||||
sign_detected = 1;
|
||||
break;
|
||||
case 'I':
|
||||
c = fetch();
|
||||
scan_state = infin_state;
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
c = fetch();
|
||||
scan_state = nan_state;
|
||||
break;
|
||||
|
||||
default:
|
||||
scan_state = sig_start;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case infin_state: {
|
||||
int i = 1;
|
||||
char model[] = "INFINITY";
|
||||
|
||||
while ((i < 8) && (toupper(c) == model[i])) {
|
||||
i++;
|
||||
c = fetch();
|
||||
}
|
||||
|
||||
if ((i == 3) || (i == 8)) {
|
||||
if (sig_negative) {
|
||||
result = (float)-(double)INFINITY;
|
||||
} else {
|
||||
result = INFINITY;
|
||||
}
|
||||
|
||||
*chars_scanned = spaces + i + sign_detected;
|
||||
return result;
|
||||
} else {
|
||||
scan_state = failure;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case nan_state: {
|
||||
int i = 1, j = 0;
|
||||
char model[] = "NAN(";
|
||||
char nan_arg[32] = "";
|
||||
while ((i < 4) && (toupper(c) == model[i])) {
|
||||
i++;
|
||||
c = fetch();
|
||||
}
|
||||
|
||||
if ((i == 3) || (i == 4)) {
|
||||
if (i == 4) {
|
||||
while ((j < 32) && (isdigit(c) || isalpha(c) || (c == radix_marker))) {
|
||||
nan_arg[j++] = (char)c;
|
||||
c = fetch();
|
||||
}
|
||||
|
||||
if (c != ')') {
|
||||
scan_state = failure;
|
||||
break;
|
||||
} else {
|
||||
j++;
|
||||
}
|
||||
}
|
||||
nan_arg[j] = '\0';
|
||||
|
||||
if (sig_negative) {
|
||||
result = -nan(nan_arg);
|
||||
} else {
|
||||
result = nan(nan_arg);
|
||||
}
|
||||
|
||||
*chars_scanned = spaces + i + j + sign_detected;
|
||||
return result;
|
||||
} else {
|
||||
scan_state = failure;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case sig_start:
|
||||
if (c == radix_marker) {
|
||||
scan_state = frac_start;
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
if (!isdigit(c)) {
|
||||
scan_state = failure;
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '0') {
|
||||
c = fetch();
|
||||
if (toupper(c) == 'X') {
|
||||
scan_state = hex_state;
|
||||
hex_scan_state = hex_start;
|
||||
} else {
|
||||
scan_state = leading_sig_zeroes;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
scan_state = int_digit_loop;
|
||||
break;
|
||||
|
||||
case leading_sig_zeroes:
|
||||
if (c == '0') {
|
||||
c = fetch();
|
||||
|
||||
break;
|
||||
}
|
||||
scan_state = int_digit_loop;
|
||||
break;
|
||||
|
||||
case int_digit_loop:
|
||||
if (!isdigit(c)) {
|
||||
if (c == radix_marker) {
|
||||
scan_state = frac_digit_loop;
|
||||
c = fetch();
|
||||
} else {
|
||||
scan_state = sig_end;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (d.sig.length < 20) {
|
||||
d.sig.text[d.sig.length++] = (unsigned char)c;
|
||||
} else {
|
||||
exp_adjust++;
|
||||
}
|
||||
|
||||
c = fetch();
|
||||
break;
|
||||
|
||||
case frac_start:
|
||||
if (!isdigit(c)) {
|
||||
scan_state = failure;
|
||||
break;
|
||||
}
|
||||
|
||||
scan_state = frac_digit_loop;
|
||||
break;
|
||||
|
||||
case frac_digit_loop:
|
||||
if (!isdigit(c)) {
|
||||
scan_state = sig_end;
|
||||
break;
|
||||
}
|
||||
|
||||
if (d.sig.length < 20) {
|
||||
if (c != '0' || d.sig.length) {
|
||||
d.sig.text[d.sig.length++] = (unsigned char)c;
|
||||
}
|
||||
|
||||
exp_adjust--;
|
||||
}
|
||||
c = fetch();
|
||||
break;
|
||||
|
||||
case sig_end:
|
||||
if (toupper(c) == 'E') {
|
||||
scan_state = exp_start;
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
scan_state = finished;
|
||||
break;
|
||||
|
||||
case exp_start:
|
||||
if (c == '+') {
|
||||
c = fetch();
|
||||
} else if (c == '-') {
|
||||
c = fetch();
|
||||
exp_negative = 1;
|
||||
}
|
||||
|
||||
scan_state = leading_exp_digit;
|
||||
break;
|
||||
|
||||
case leading_exp_digit:
|
||||
if (!isdigit(c)) {
|
||||
scan_state = failure;
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '0') {
|
||||
scan_state = leading_exp_zeroes;
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
|
||||
scan_state = exp_digit_loop;
|
||||
break;
|
||||
|
||||
case leading_exp_zeroes:
|
||||
if (c == '0') {
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
|
||||
scan_state = exp_digit_loop;
|
||||
break;
|
||||
|
||||
case exp_digit_loop:
|
||||
if (!isdigit(c)) {
|
||||
scan_state = finished;
|
||||
break;
|
||||
}
|
||||
|
||||
exp_value = exp_value * 10 + (c - '0');
|
||||
if (exp_value > 0x7FFF) {
|
||||
*overflow = 1;
|
||||
}
|
||||
|
||||
c = fetch();
|
||||
break;
|
||||
|
||||
case hex_state: {
|
||||
switch (hex_scan_state) {
|
||||
case hex_start:
|
||||
memset(mantissa, 0, sizeof(mantissa));
|
||||
chptr = mantissa;
|
||||
mantissa_digits = (53 + 3) / 4;
|
||||
intdigits = 0;
|
||||
NibbleIndex = 0;
|
||||
hex_scan_state = hex_leading_sig_zeroes;
|
||||
c = fetch();
|
||||
break;
|
||||
|
||||
case hex_leading_sig_zeroes:
|
||||
if (c == '0') {
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
|
||||
hex_scan_state = hex_int_digit_loop;
|
||||
break;
|
||||
|
||||
case hex_int_digit_loop:
|
||||
if (!isxdigit(c)) {
|
||||
if (c == radix_marker) {
|
||||
hex_scan_state = hex_frac_digit_loop;
|
||||
c = fetch();
|
||||
}
|
||||
|
||||
else {
|
||||
hex_scan_state = hex_sig_end;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (intdigits < mantissa_digits) {
|
||||
intdigits++;
|
||||
uch = *(chptr + NibbleIndex / 2);
|
||||
|
||||
ui = toupper(c);
|
||||
if (ui >= 'A') {
|
||||
ui = ui - 'A' + 10;
|
||||
} else {
|
||||
ui -= '0';
|
||||
}
|
||||
|
||||
uch1 = (unsigned char)ui;
|
||||
|
||||
if ((NibbleIndex % 2) != 0) {
|
||||
uch |= uch1;
|
||||
} else {
|
||||
uch |= (unsigned char)(uch1 << 4);
|
||||
}
|
||||
|
||||
*(chptr + NibbleIndex++ / 2) = uch;
|
||||
c = fetch();
|
||||
}
|
||||
|
||||
else {
|
||||
c = fetch();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case hex_frac_digit_loop:
|
||||
if (!isxdigit(c)) {
|
||||
hex_scan_state = hex_sig_end;
|
||||
break;
|
||||
}
|
||||
|
||||
if (intdigits < mantissa_digits) {
|
||||
uch = *(chptr + NibbleIndex / 2);
|
||||
ui = toupper(c);
|
||||
|
||||
if (ui >= 'A') {
|
||||
ui = ui - 'A' + 10;
|
||||
} else {
|
||||
ui -= '0';
|
||||
}
|
||||
|
||||
uch1 = (unsigned char)ui;
|
||||
|
||||
if ((NibbleIndex % 2) != 0) {
|
||||
uch |= uch1;
|
||||
} else {
|
||||
uch |= (unsigned char)(uch1 << 4);
|
||||
}
|
||||
|
||||
*(chptr + NibbleIndex++ / 2) = uch;
|
||||
c = fetch();
|
||||
} else {
|
||||
c = fetch();
|
||||
}
|
||||
break;
|
||||
|
||||
case hex_sig_end:
|
||||
if (toupper(c) == 'P') {
|
||||
hex_scan_state = hex_exp_start;
|
||||
exp_digits++;
|
||||
c = fetch();
|
||||
} else {
|
||||
scan_state = finished;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case hex_exp_start:
|
||||
exp_digits++;
|
||||
if (c == '-') {
|
||||
expsign = 1;
|
||||
} else if (c != '+') {
|
||||
c = unfetch(c);
|
||||
count--;
|
||||
exp_digits--;
|
||||
}
|
||||
|
||||
hex_scan_state = hex_leading_exp_digit;
|
||||
c = fetch();
|
||||
break;
|
||||
|
||||
case hex_leading_exp_digit:
|
||||
if (!isdigit(c)) {
|
||||
scan_state = failure;
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '0') {
|
||||
exp_digits++;
|
||||
hex_scan_state = hex_leading_exp_zeroes;
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
|
||||
hex_scan_state = hex_exp_digit_loop;
|
||||
break;
|
||||
|
||||
case hex_leading_exp_zeroes:
|
||||
if (c == '0') {
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
|
||||
hex_scan_state = hex_exp_digit_loop;
|
||||
break;
|
||||
|
||||
case hex_exp_digit_loop:
|
||||
if (!isdigit(c)) {
|
||||
scan_state = finished;
|
||||
break;
|
||||
}
|
||||
|
||||
exponent = exponent * 10 + (c - '0');
|
||||
|
||||
if (exp_value > SHRT_MAX) {
|
||||
*overflow = 1;
|
||||
}
|
||||
|
||||
exp_digits++;
|
||||
c = fetch();
|
||||
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
if (scan_state != 32768 ? !success(scan_state) : !hex_success(count, hex_scan_state)) {
|
||||
count = 0;
|
||||
*chars_scanned = 0;
|
||||
} else {
|
||||
count--;
|
||||
*chars_scanned = count + spaces;
|
||||
}
|
||||
|
||||
unfetch(c);
|
||||
|
||||
if (hex_scan_state == not_hex) {
|
||||
if (exp_negative) {
|
||||
exp_value = -exp_value;
|
||||
}
|
||||
|
||||
{
|
||||
int n = d.sig.length;
|
||||
unsigned char* p = &d.sig.text[n];
|
||||
|
||||
while (n-- && *--p == '0') {
|
||||
exp_adjust++;
|
||||
}
|
||||
|
||||
d.sig.length = (unsigned char)(n + 1);
|
||||
|
||||
if (d.sig.length == 0) {
|
||||
d.sig.text[d.sig.length++] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
exp_value += exp_adjust;
|
||||
|
||||
if (exp_value < -0x8000 || exp_value > 0x7FFF) {
|
||||
*overflow = 1;
|
||||
}
|
||||
|
||||
if (*overflow) {
|
||||
if (exp_negative) {
|
||||
return 0.0;
|
||||
} else {
|
||||
return sig_negative ? -HUGE_VAL : HUGE_VAL;
|
||||
}
|
||||
}
|
||||
|
||||
d.exp = (short)exp_value;
|
||||
|
||||
result = __dec2num(&d);
|
||||
|
||||
if (result != 0.0 && result < LDBL_MIN) {
|
||||
*overflow = 1;
|
||||
} else if (result > LDBL_MAX) {
|
||||
*overflow = 1;
|
||||
result = HUGE_VAL;
|
||||
}
|
||||
|
||||
if (sig_negative && success(scan_state)) {
|
||||
result = -result;
|
||||
}
|
||||
|
||||
return result;
|
||||
} else {
|
||||
unsigned mantissa_bit, dbl_bit;
|
||||
unsigned one_bit;
|
||||
long double dbl_bits_storage;
|
||||
unsigned char* dbl_bits = (unsigned char*)&dbl_bits_storage;
|
||||
|
||||
if (expsign) {
|
||||
exponent = -exponent;
|
||||
}
|
||||
|
||||
exponent += intdigits * 4;
|
||||
|
||||
one_bit = 0;
|
||||
while (one_bit < 4 && !(mantissa[0] & (0x80 >> one_bit))) {
|
||||
one_bit++;
|
||||
exponent--;
|
||||
}
|
||||
|
||||
if (TARGET_FLOAT_IMPLICIT_J_BIT) {
|
||||
one_bit++;
|
||||
}
|
||||
|
||||
if (one_bit) {
|
||||
unsigned char carry = 0;
|
||||
for (chptr = mantissa + sizeof(mantissa) - 1; chptr >= mantissa; chptr--) {
|
||||
unsigned char a = *chptr;
|
||||
*chptr = (unsigned char)((a << one_bit) | carry);
|
||||
carry = (unsigned char)(a >> (8 - one_bit));
|
||||
}
|
||||
}
|
||||
|
||||
memset(dbl_bits, 0, sizeof(dbl_bits_storage));
|
||||
dbl_bit = (TARGET_FLOAT_BITS - TARGET_FLOAT_MANT_BITS);
|
||||
|
||||
for (mantissa_bit = 0; mantissa_bit < TARGET_FLOAT_MANT_BITS; mantissa_bit += 8) {
|
||||
unsigned char ui = mantissa[mantissa_bit >> 3];
|
||||
int halfbits;
|
||||
|
||||
if (mantissa_bit + 8 > TARGET_FLOAT_MANT_BITS) {
|
||||
ui &= 0xff << (TARGET_FLOAT_MANT_BITS - mantissa_bit);
|
||||
}
|
||||
|
||||
halfbits = (dbl_bit & 7);
|
||||
dbl_bits[dbl_bit >> 3] |= (unsigned char)(ui >> halfbits);
|
||||
dbl_bit += 8;
|
||||
dbl_bits[dbl_bit >> 3] |= (unsigned char)(ui << (8 - halfbits));
|
||||
}
|
||||
|
||||
exponent += TARGET_FLOAT_MAX_EXP - 2;
|
||||
|
||||
if ((exponent & ~(TARGET_FLOAT_MAX_EXP * 2 - 1))) {
|
||||
*overflow = 1;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
exponent <<= 32 - TARGET_FLOAT_EXP_BITS;
|
||||
|
||||
dbl_bits[0] |= exponent >> 25;
|
||||
|
||||
if (TARGET_FLOAT_EXP_BITS > 7) {
|
||||
dbl_bits[1] |= exponent >> 17;
|
||||
}
|
||||
|
||||
if (TARGET_FLOAT_EXP_BITS > 15) {
|
||||
dbl_bits[2] |= exponent >> 9;
|
||||
}
|
||||
|
||||
if (TARGET_FLOAT_EXP_BITS > 23) {
|
||||
dbl_bits[3] |= exponent >> 1;
|
||||
}
|
||||
|
||||
if (sig_negative) {
|
||||
dbl_bits[0] |= 0x80;
|
||||
}
|
||||
|
||||
result = *(long double*)dbl_bits;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
double strtod(const char* str, char** end) {
|
||||
__InStrCtrl isc;
|
||||
double value, abs_value;
|
||||
int count, overflow;
|
||||
|
||||
isc.NextChar = (char*)str;
|
||||
isc.NullCharDetected = 0;
|
||||
value = __strtold(INT_MAX, &__StringRead, (void*)&isc, &count, &overflow);
|
||||
|
||||
if (end) {
|
||||
*end = (char*)str + count;
|
||||
}
|
||||
|
||||
abs_value = fabs(value);
|
||||
if (overflow || (value != 0.0 && (abs_value < DBL_MIN || abs_value > DBL_MAX))) {
|
||||
errno = ERANGE;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,727 +0,0 @@
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <internal/locale.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
||||
typedef struct tm {
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mday;
|
||||
int tm_mon;
|
||||
int tm_year;
|
||||
int tm_wday;
|
||||
int tm_yday;
|
||||
int tm_isdst;
|
||||
} tm;
|
||||
|
||||
extern int __msl_mod(int, int);
|
||||
extern div_t __msl_div(long, long);
|
||||
extern int __msl_add(int*, int);
|
||||
extern int __msl_ladd(long*, long);
|
||||
extern int __msl_lmul(long*, long);
|
||||
|
||||
static int __leap_year(int year) {
|
||||
return __msl_mod(year, 4) == 0 && (__msl_mod(year, 100) != 0 || __msl_mod(year, 400) == 100);
|
||||
}
|
||||
|
||||
static int leap_days(int year, int month) {
|
||||
int n;
|
||||
div_t q;
|
||||
|
||||
q = div(year, 4);
|
||||
n = q.quot;
|
||||
|
||||
q = div(year, 100);
|
||||
n -= q.quot;
|
||||
|
||||
if (year < 100) {
|
||||
q = __msl_div(year + 899, 1000);
|
||||
n += q.quot;
|
||||
} else {
|
||||
q = __msl_div(year - 100, 1000);
|
||||
n += q.quot + 1;
|
||||
}
|
||||
|
||||
if (__leap_year(year)) {
|
||||
if (year < 0) {
|
||||
if (month > 1) {
|
||||
n++;
|
||||
}
|
||||
} else if (month <= 1) {
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
#define seconds_per_minute (60L)
|
||||
#define seconds_per_hour (60L * seconds_per_minute)
|
||||
#define seconds_per_day (24L * seconds_per_hour)
|
||||
#define seconds_1900_to_1970 (((365 * 70UL) + 17) * 24 * 60 * 60)
|
||||
|
||||
const short __msl_month_to_days[2][13] = {
|
||||
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
|
||||
{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
|
||||
};
|
||||
|
||||
extern int __isdst(void);
|
||||
extern time_t __get_time(void);
|
||||
extern int __to_gm_time(time_t*);
|
||||
|
||||
void __msl_time2tm(time_t in_time, tm* tm) {
|
||||
unsigned long years, months, days, seconds;
|
||||
int is_leap_year;
|
||||
unsigned long time = in_time + seconds_1900_to_1970;
|
||||
|
||||
if (!tm) {
|
||||
return;
|
||||
}
|
||||
|
||||
tm->tm_isdst = __isdst();
|
||||
|
||||
days = time / seconds_per_day;
|
||||
seconds = time % seconds_per_day;
|
||||
|
||||
tm->tm_wday = (days + 1) % 7;
|
||||
years = 0;
|
||||
|
||||
for (;;) {
|
||||
unsigned long days_this_year = __leap_year(years) ? 366 : 365;
|
||||
|
||||
if (days < days_this_year) {
|
||||
break;
|
||||
}
|
||||
|
||||
days -= days_this_year;
|
||||
years += 1;
|
||||
}
|
||||
|
||||
tm->tm_year = years;
|
||||
tm->tm_yday = days;
|
||||
|
||||
months = 0;
|
||||
is_leap_year = __leap_year(years);
|
||||
|
||||
for (;;) {
|
||||
unsigned long days_thru_this_month = __msl_month_to_days[is_leap_year][months + 1];
|
||||
|
||||
if (days < days_thru_this_month) {
|
||||
days -= __msl_month_to_days[is_leap_year][months];
|
||||
break;
|
||||
}
|
||||
|
||||
++months;
|
||||
}
|
||||
|
||||
tm->tm_mon = months;
|
||||
tm->tm_mday = days + 1;
|
||||
tm->tm_hour = seconds / seconds_per_hour;
|
||||
seconds %= seconds_per_hour;
|
||||
tm->tm_min = seconds / seconds_per_minute;
|
||||
tm->tm_sec = seconds % seconds_per_minute;
|
||||
}
|
||||
|
||||
static int adjust(int* x, int y, int* z) {
|
||||
div_t q;
|
||||
|
||||
q = __msl_div(*x, y);
|
||||
*x = q.rem;
|
||||
return __msl_add(z, q.quot);
|
||||
}
|
||||
|
||||
static int __tm2time(tm* tm, time_t* time) {
|
||||
long days;
|
||||
time_t seconds, day_secs;
|
||||
|
||||
if (!tm || !time) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
--tm->tm_mday;
|
||||
|
||||
if (!adjust(&tm->tm_sec, 60, &tm->tm_min)) {
|
||||
goto no_exit;
|
||||
}
|
||||
if (!adjust(&tm->tm_min, 60, &tm->tm_hour)) {
|
||||
goto no_exit;
|
||||
}
|
||||
if (!adjust(&tm->tm_hour, 24, &tm->tm_mday)) {
|
||||
goto no_exit;
|
||||
}
|
||||
if (!adjust(&tm->tm_mon, 12, &tm->tm_year)) {
|
||||
goto no_exit;
|
||||
}
|
||||
|
||||
days = tm->tm_year;
|
||||
|
||||
if (!__msl_lmul(&days, 365)) {
|
||||
goto no_exit;
|
||||
}
|
||||
if (!__msl_ladd(&days, leap_days(tm->tm_year, tm->tm_mon))) {
|
||||
goto no_exit;
|
||||
}
|
||||
if (!__msl_ladd(&days, __msl_month_to_days[0][tm->tm_mon])) {
|
||||
goto no_exit;
|
||||
}
|
||||
if (!__msl_ladd(&days, tm->tm_mday)) {
|
||||
goto no_exit;
|
||||
}
|
||||
if (days < 0 || days > (ULONG_MAX / seconds_per_day)) {
|
||||
goto no_exit;
|
||||
}
|
||||
|
||||
day_secs = days * seconds_per_day;
|
||||
seconds = (tm->tm_hour * seconds_per_hour) + (tm->tm_min * seconds_per_minute) + tm->tm_sec;
|
||||
|
||||
if (seconds > ULONG_MAX - day_secs) {
|
||||
goto no_exit;
|
||||
}
|
||||
|
||||
seconds += day_secs;
|
||||
seconds -= seconds_1900_to_1970;
|
||||
*time = seconds;
|
||||
|
||||
__msl_time2tm(seconds, tm);
|
||||
return 1;
|
||||
|
||||
no_exit:
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern clock_t __get_clock(void);
|
||||
|
||||
clock_t clock(void) {
|
||||
return __get_clock();
|
||||
}
|
||||
|
||||
time_t mktime(tm* timeptr) {
|
||||
struct tm tm = *timeptr;
|
||||
time_t time;
|
||||
|
||||
if (!__tm2time(&tm, &time)) {
|
||||
return (time_t)-1;
|
||||
}
|
||||
|
||||
*timeptr = tm;
|
||||
return time;
|
||||
}
|
||||
|
||||
static void clear_tm(struct tm* tm) {
|
||||
tm->tm_sec = 0;
|
||||
tm->tm_min = 0;
|
||||
tm->tm_hour = 0;
|
||||
tm->tm_mday = 1;
|
||||
tm->tm_mon = 0;
|
||||
tm->tm_year = 0;
|
||||
tm->tm_wday = 1;
|
||||
tm->tm_yday = 0;
|
||||
tm->tm_isdst = -1;
|
||||
}
|
||||
|
||||
static char* find_name(const char* names, int index) {
|
||||
static char extracted_name[32];
|
||||
int i;
|
||||
const char* start = names;
|
||||
const char* end;
|
||||
|
||||
for (i = 0; i <= index; i++) {
|
||||
end = strchr(start, '|');
|
||||
if (i == index) {
|
||||
if (end == NULL) {
|
||||
strcpy(extracted_name, start);
|
||||
} else {
|
||||
strncpy(extracted_name, start, end - start);
|
||||
extracted_name[end - start] = '\0';
|
||||
}
|
||||
break;
|
||||
}
|
||||
start = end + 1;
|
||||
}
|
||||
|
||||
return extracted_name;
|
||||
}
|
||||
|
||||
#pragma exceptions off
|
||||
|
||||
char* asctime(const struct tm* timeptr) {
|
||||
static char asctime_result[26];
|
||||
char* result = asctime_result;
|
||||
if (!timeptr) {
|
||||
strcpy(result, "xxx xxx xx xx:xx:xx xxxx\n");
|
||||
} else {
|
||||
char day[4];
|
||||
char month[4];
|
||||
strncpy(day, find_name(_current_locale.time_cmpt_ptr->Day_Names, timeptr->tm_wday * 2), 3);
|
||||
day[3] = 0;
|
||||
strncpy(month, find_name(_current_locale.time_cmpt_ptr->MonthNames, timeptr->tm_mon * 2), 3);
|
||||
month[3] = 0;
|
||||
sprintf(result, "%s %s%3d %.2d:%.2d:%.2d %d\n", day, month, timeptr->tm_mday,
|
||||
timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec, timeptr->tm_year + 1900);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
struct tm* localtime(const time_t* timer);
|
||||
|
||||
char* ctime(const time_t* timer) {
|
||||
struct tm* calendar = localtime(timer);
|
||||
char* result = asctime(calendar);
|
||||
char day[4];
|
||||
char month[4];
|
||||
strncpy(day, find_name(_current_locale.time_cmpt_ptr->Day_Names, calendar->tm_wday * 2), 3);
|
||||
day[3] = 0;
|
||||
strncpy(month, find_name(_current_locale.time_cmpt_ptr->MonthNames, calendar->tm_mon * 2), 3);
|
||||
month[3] = 0;
|
||||
sprintf(result, "%.3s %.3s %2d %.2d:%.2d:%.2d %4d\n", day, month,
|
||||
calendar->tm_mday, calendar->tm_hour, calendar->tm_min, calendar->tm_sec,
|
||||
calendar->tm_year + 1900);
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma exceptions on
|
||||
|
||||
static time_t time(time_t* timer) {
|
||||
time_t result = __get_time();
|
||||
|
||||
if (timer) {
|
||||
*timer = result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static struct tm* gmtime(const time_t* timer) {
|
||||
static struct tm gmtime_tm;
|
||||
time_t time;
|
||||
|
||||
if (!timer) {
|
||||
clear_tm(&gmtime_tm);
|
||||
return &gmtime_tm;
|
||||
}
|
||||
|
||||
time = *timer;
|
||||
if (!__to_gm_time(&time)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__msl_time2tm(time, &gmtime_tm);
|
||||
gmtime_tm.tm_isdst = 0;
|
||||
return &gmtime_tm;
|
||||
}
|
||||
|
||||
#pragma exceptions on
|
||||
|
||||
struct tm* localtime(const time_t* timer) {
|
||||
static struct tm localtime_tm;
|
||||
|
||||
if (!timer) {
|
||||
clear_tm(&localtime_tm);
|
||||
localtime_tm.tm_isdst = __isdst();
|
||||
return &localtime_tm;
|
||||
} else {
|
||||
__msl_time2tm(*timer, &localtime_tm);
|
||||
localtime_tm.tm_isdst = __isdst();
|
||||
return &localtime_tm;
|
||||
}
|
||||
}
|
||||
|
||||
static int emit(char* str, size_t size, size_t* max_size, const char* format_str, ...) {
|
||||
va_list args;
|
||||
va_start(args, format_str);
|
||||
|
||||
if (size > *max_size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*max_size -= size;
|
||||
return vsprintf(str, format_str, args);
|
||||
}
|
||||
|
||||
time_t __MSL_ISO8601NewYear(int year) {
|
||||
struct tm ts0;
|
||||
time_t timeval;
|
||||
short StartMday[7] = {2, 3, 4, 29, 30, 31, 1};
|
||||
|
||||
ts0.tm_sec = 0;
|
||||
ts0.tm_min = 0;
|
||||
ts0.tm_hour = 0;
|
||||
ts0.tm_mon = 0;
|
||||
ts0.tm_isdst = -1;
|
||||
ts0.tm_mday = 0;
|
||||
ts0.tm_wday = 7;
|
||||
ts0.tm_year = year;
|
||||
while ((ts0.tm_wday != 0) && (ts0.tm_mday <= 7)) {
|
||||
ts0.tm_mday++;
|
||||
timeval = mktime(&ts0);
|
||||
}
|
||||
ts0.tm_mday = StartMday[ts0.tm_mday - 1];
|
||||
if (ts0.tm_mday >= 29) {
|
||||
ts0.tm_mon = 11;
|
||||
ts0.tm_year--;
|
||||
}
|
||||
return mktime(&ts0);
|
||||
}
|
||||
|
||||
static double difftime(time_t time1, time_t time0) {
|
||||
time_t diff;
|
||||
|
||||
if (time1 >= time0) {
|
||||
return time1 - time0;
|
||||
}
|
||||
|
||||
diff = time0 - time1;
|
||||
return -(double)diff;
|
||||
}
|
||||
|
||||
extern const double msl_seconds_per_day;
|
||||
extern const double msl_days_per_week;
|
||||
extern const double msl_seconds_per_minute;
|
||||
|
||||
int __MSL_ISO8601Week(const struct tm* tmptr, int* WYear) {
|
||||
struct WeekYear {
|
||||
int Year;
|
||||
time_t Start;
|
||||
};
|
||||
struct WeekYear LastYear, ThisYear, NextYear;
|
||||
struct WeekYear* WyPtr;
|
||||
struct tm Localtm = *tmptr;
|
||||
double Days;
|
||||
int WeekNo;
|
||||
time_t GivenTimeVal;
|
||||
|
||||
LastYear.Year = tmptr->tm_year - 1;
|
||||
LastYear.Start = __MSL_ISO8601NewYear(LastYear.Year);
|
||||
ThisYear.Year = tmptr->tm_year;
|
||||
ThisYear.Start = __MSL_ISO8601NewYear(ThisYear.Year);
|
||||
NextYear.Year = tmptr->tm_year + 1;
|
||||
NextYear.Start = __MSL_ISO8601NewYear(NextYear.Year);
|
||||
|
||||
GivenTimeVal = mktime(&Localtm);
|
||||
if ((LastYear.Start <= GivenTimeVal) && (GivenTimeVal < ThisYear.Start)) {
|
||||
WyPtr = &LastYear;
|
||||
} else if ((ThisYear.Start <= GivenTimeVal) && (GivenTimeVal < NextYear.Start)) {
|
||||
WyPtr = &ThisYear;
|
||||
} else {
|
||||
WyPtr = &NextYear;
|
||||
}
|
||||
*WYear = WyPtr->Year;
|
||||
{
|
||||
double diff;
|
||||
|
||||
if (GivenTimeVal >= WyPtr->Start) {
|
||||
diff = (double)(GivenTimeVal - WyPtr->Start);
|
||||
} else {
|
||||
diff = -(double)(WyPtr->Start - GivenTimeVal);
|
||||
}
|
||||
Days = diff / msl_seconds_per_day;
|
||||
}
|
||||
WeekNo = (int)(Days / msl_days_per_week) + 1;
|
||||
return WeekNo;
|
||||
}
|
||||
|
||||
static int week_num(const struct tm* tm, int starting_day) {
|
||||
int days = tm->tm_yday;
|
||||
|
||||
days -= __msl_mod(tm->tm_wday - starting_day, 7);
|
||||
|
||||
if (days < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (days / 7) + 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int emit_string(char* str, size_t size, size_t* max_size, const char* value) {
|
||||
return emit(str, size, max_size, "%s", value);
|
||||
}
|
||||
|
||||
|
||||
size_t strftime(char* str, size_t max_size, const char* format_str, const struct tm* timeptr) {
|
||||
char name[32];
|
||||
size_t num_chars, chars_written, space_remaining;
|
||||
struct __locale* locale = &_current_locale;
|
||||
const char* format_ptr;
|
||||
const char* curr_format;
|
||||
int n, ISO8601Year, ISO8601WeekNo;
|
||||
struct tm tm;
|
||||
struct tm defaults = {0, 0, 0, 1, 0, 0, 1, 0, -1};
|
||||
|
||||
if ((space_remaining = --max_size) <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
tm = defaults;
|
||||
|
||||
if (timeptr) {
|
||||
tm = *timeptr;
|
||||
|
||||
if (mktime(&tm) == (time_t)-1) {
|
||||
tm = defaults;
|
||||
}
|
||||
}
|
||||
|
||||
format_ptr = format_str;
|
||||
chars_written = 0;
|
||||
|
||||
while (*format_ptr) {
|
||||
if (!(curr_format = strchr(format_ptr, '%'))) {
|
||||
if ((num_chars = strlen(format_ptr)) != 0) {
|
||||
if (num_chars <= space_remaining) {
|
||||
memcpy(str, format_ptr, num_chars);
|
||||
|
||||
chars_written += num_chars;
|
||||
str += num_chars;
|
||||
space_remaining -= num_chars;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((num_chars = curr_format - format_ptr) != 0) {
|
||||
if (num_chars <= space_remaining) {
|
||||
memcpy(str, format_ptr, num_chars);
|
||||
|
||||
chars_written += num_chars;
|
||||
str += num_chars;
|
||||
space_remaining -= num_chars;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
format_ptr = curr_format;
|
||||
if (format_ptr[1] == 'E' || format_ptr[1] == 'O') {
|
||||
++format_ptr;
|
||||
}
|
||||
|
||||
switch (*++format_ptr) {
|
||||
case 'a':
|
||||
strcpy(name, find_name(locale->time_cmpt_ptr->Day_Names, tm.tm_wday * 2));
|
||||
num_chars = emit_string(str, strlen(name), &space_remaining, name);
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
strcpy(name, find_name(locale->time_cmpt_ptr->Day_Names, tm.tm_wday * 2 + 1));
|
||||
num_chars = emit_string(str, strlen(name), &space_remaining, name);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
case 'h': {
|
||||
num_chars =
|
||||
emit(str, 3, &space_remaining, "%.3s",
|
||||
find_name(locale->time_cmpt_ptr->MonthNames, tm.tm_mon * 2));
|
||||
break;
|
||||
}
|
||||
|
||||
case 'B':
|
||||
strcpy(name, find_name(locale->time_cmpt_ptr->MonthNames, tm.tm_mon * 2 + 1));
|
||||
num_chars = emit_string(str, strlen(name), &space_remaining, name);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
num_chars = strftime(str, space_remaining + 1, locale->time_cmpt_ptr->DateTime_Format, &tm);
|
||||
space_remaining -= num_chars;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d", tm.tm_mday);
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
num_chars = strftime(str, space_remaining + 1, "%m/%d/%y", &tm);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
num_chars = emit(str, 2, &space_remaining, "%2d", tm.tm_mday);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
num_chars =
|
||||
emit(str, 10, &space_remaining, "%.4d-%.2d-%.2d", tm.tm_year + 1900, tm.tm_mon + 1,
|
||||
tm.tm_mday);
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
ISO8601WeekNo = __MSL_ISO8601Week(timeptr, &ISO8601Year);
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d", ISO8601Year % 100);
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
ISO8601WeekNo = __MSL_ISO8601Week(timeptr, &ISO8601Year);
|
||||
num_chars = emit(str, 4, &space_remaining, "%.4d", ISO8601Year + 1900);
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d", tm.tm_hour);
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d",
|
||||
(n = tm.tm_hour % 12) ? n : 12);
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
num_chars = emit(str, 3, &space_remaining, "%.3d", tm.tm_yday + 1);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d", tm.tm_mon + 1);
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d", tm.tm_min);
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
num_chars = emit(str, 2, &space_remaining, "\n");
|
||||
break;
|
||||
|
||||
case 'p': {
|
||||
char* name;
|
||||
|
||||
name = find_name(locale->time_cmpt_ptr->am_pm, tm.tm_hour < 12 ? 0 : 1);
|
||||
num_chars = emit_string(str, strlen(name), &space_remaining, name);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'r':
|
||||
num_chars = strftime(str, space_remaining + 1, locale->time_cmpt_ptr->Twelve_hr_format, &tm);
|
||||
space_remaining -= num_chars;
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
num_chars = strftime(str, space_remaining + 1, "%H:%M", &tm);
|
||||
space_remaining -= num_chars;
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d", tm.tm_sec);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
num_chars = emit(str, 2, &space_remaining, "\t");
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
num_chars = strftime(str, space_remaining + 1, "%H:%M:%S", &tm);
|
||||
space_remaining -= num_chars;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
if (tm.tm_wday == 0) {
|
||||
num_chars = emit(str, 1, &space_remaining, "7");
|
||||
} else {
|
||||
num_chars = emit(str, 1, &space_remaining, "%.1d", tm.tm_wday);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d", week_num(&tm, 0));
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
ISO8601WeekNo = __MSL_ISO8601Week(timeptr, &ISO8601Year);
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d", ISO8601WeekNo);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
num_chars = emit(str, 1, &space_remaining, "%.1d", tm.tm_wday);
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d", week_num(&tm, 1));
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
num_chars = strftime(str, space_remaining + 1, locale->time_cmpt_ptr->Date_Format, &tm);
|
||||
space_remaining -= num_chars;
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
num_chars = strftime(str, space_remaining + 1, locale->time_cmpt_ptr->Time_Format, &tm);
|
||||
space_remaining -= num_chars;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
case 'C':
|
||||
num_chars = emit(str, 2, &space_remaining, "%.2d", tm.tm_year % 100);
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
num_chars = emit(str, 4, &space_remaining, "%.4d", tm.tm_year + 1900);
|
||||
break;
|
||||
|
||||
case 'z': {
|
||||
time_t local, utc, now;
|
||||
struct tm localtm, *utctmptr;
|
||||
double diff, diffmins, diffhours;
|
||||
|
||||
now = time(NULL);
|
||||
utctmptr = gmtime(&now);
|
||||
if (utctmptr == NULL) {
|
||||
num_chars = emit(str, 4, &space_remaining, "0000");
|
||||
} else {
|
||||
localtm = *localtime(&now);
|
||||
local = mktime(&localtm);
|
||||
utc = mktime(utctmptr);
|
||||
diff = difftime(local, utc);
|
||||
diffhours = (int)diff / 3600;
|
||||
diffmins = __abs(diff / msl_seconds_per_minute - msl_seconds_per_minute * diffhours);
|
||||
num_chars = emit(str, 5, &space_remaining, "%+03.0f%02.0f", diffhours, diffmins);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'Z': {
|
||||
char* TimeZone = locale->time_cmpt_ptr->TimeZone;
|
||||
|
||||
if (*TimeZone == '\0') {
|
||||
num_chars = 0;
|
||||
*str = '\0';
|
||||
} else {
|
||||
num_chars = emit_string(str, strlen(TimeZone), &space_remaining, TimeZone);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case '%':
|
||||
num_chars = emit(str, 2, &space_remaining, "%%", *format_ptr);
|
||||
break;
|
||||
|
||||
default:
|
||||
num_chars = emit(str, 2, &space_remaining, "%%%c", *format_ptr);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!num_chars) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
chars_written += num_chars;
|
||||
str += num_chars;
|
||||
++format_ptr;
|
||||
}
|
||||
|
||||
*str = 0;
|
||||
if (max_size < chars_written) {
|
||||
return 0;
|
||||
} else {
|
||||
return chars_written;
|
||||
}
|
||||
}
|
||||
|
||||
const double msl_seconds_per_day = 86400.0;
|
||||
const double msl_days_per_week = 7.0;
|
||||
const double msl_seconds_per_minute = 60.0;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,671 +0,0 @@
|
||||
#include <internal/format_runtime.h>
|
||||
#define LDBL_MAX DBL_MAX
|
||||
|
||||
|
||||
|
||||
typedef unsigned long long d_int;
|
||||
|
||||
static inline int __count_trailing_zerol(unsigned long x) { return 32 - __cntlzw(~x & (x - 1)); }
|
||||
|
||||
static int __count_trailing_zero(double n) {
|
||||
unsigned long* array = (unsigned long*)&n;
|
||||
|
||||
unsigned long hi = array[0] | 0x100000;
|
||||
unsigned long lo = array[1];
|
||||
int zeros = __count_trailing_zerol(lo);
|
||||
|
||||
if (lo == 0) {
|
||||
return 32 + __count_trailing_zerol(hi);
|
||||
}
|
||||
return zeros;
|
||||
}
|
||||
|
||||
static int __must_round(const decimal* d, int digits) {
|
||||
unsigned char const* i = d->sig.text + digits;
|
||||
|
||||
if (*i > 5) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*i < 5) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
unsigned char const* e = d->sig.text + d->sig.length;
|
||||
|
||||
for (i++; i < e; i++) {
|
||||
if (*i != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (d->sig.text[digits - 1] & 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void __dorounddecup(decimal* d, int digits) {
|
||||
unsigned char* b = d->sig.text;
|
||||
unsigned char* i = b + digits - 1;
|
||||
|
||||
while (1) {
|
||||
if (*i < 9) {
|
||||
*i += 1;
|
||||
break;
|
||||
}
|
||||
if (i == b) {
|
||||
*i = 1;
|
||||
d->exp++;
|
||||
break;
|
||||
}
|
||||
*i-- = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void __rounddec(decimal* d, int digits) {
|
||||
if (digits > 0 && digits < d->sig.length) {
|
||||
int unkBool = __must_round(d, digits);
|
||||
d->sig.length = digits;
|
||||
|
||||
if (unkBool >= 0) {
|
||||
__dorounddecup(d, digits);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void __ull2dec(decimal* result, unsigned long long val) {
|
||||
result->sign = 0;
|
||||
result->sig.length = 0;
|
||||
|
||||
for (; val != 0; val /= 10) {
|
||||
result->sig.text[result->sig.length++] = (unsigned char)(val % 10);
|
||||
}
|
||||
|
||||
{
|
||||
unsigned char* i = result->sig.text;
|
||||
unsigned char* j = result->sig.text + result->sig.length;
|
||||
|
||||
for (; i < --j; ++i) {
|
||||
unsigned char t = *i;
|
||||
*i = *j;
|
||||
*j = t;
|
||||
}
|
||||
}
|
||||
|
||||
result->exp = result->sig.length - 1;
|
||||
}
|
||||
|
||||
static void __timesdec(decimal* result, const decimal* x, const decimal* y) {
|
||||
unsigned long accumulator = 0;
|
||||
unsigned char mantissa[SIGDIGLEN * 2];
|
||||
int i = x->sig.length + y->sig.length - 1;
|
||||
unsigned char* pDigit;
|
||||
unsigned char* ip = mantissa + i + 1;
|
||||
unsigned char* ep = ip;
|
||||
|
||||
result->sign = 0;
|
||||
|
||||
for (; i > 0; i--) {
|
||||
int k = y->sig.length - 1;
|
||||
int j = i - k - 1;
|
||||
int l;
|
||||
int t;
|
||||
const unsigned char* jp;
|
||||
const unsigned char* kp;
|
||||
|
||||
if (j < 0) {
|
||||
j = 0;
|
||||
k = i - 1;
|
||||
}
|
||||
|
||||
jp = x->sig.text + j;
|
||||
kp = y->sig.text + k;
|
||||
l = k + 1;
|
||||
t = x->sig.length - j;
|
||||
|
||||
if (l > t)
|
||||
l = t;
|
||||
|
||||
for (; l > 0; l--, jp++, kp--) {
|
||||
accumulator += *jp * *kp;
|
||||
}
|
||||
|
||||
*--ip = (unsigned char)(accumulator % 10);
|
||||
accumulator /= 10;
|
||||
}
|
||||
|
||||
result->exp = (short)(x->exp + y->exp);
|
||||
|
||||
if (accumulator) {
|
||||
*--ip = (unsigned char)(accumulator);
|
||||
result->exp++;
|
||||
}
|
||||
|
||||
for (i = 0; i < SIGDIGLEN && ip < ep; i++, ip++) {
|
||||
result->sig.text[i] = *ip;
|
||||
}
|
||||
result->sig.length = (unsigned char)(i);
|
||||
|
||||
if (ip < ep && *ip >= 5) {
|
||||
if (*ip == 5) {
|
||||
unsigned char* jp = ip + 1;
|
||||
for (; jp < ep; jp++) {
|
||||
if (*jp != 0)
|
||||
goto round;
|
||||
}
|
||||
if ((ip[-1] & 1) == 0)
|
||||
return;
|
||||
}
|
||||
round:
|
||||
__dorounddecup(result, result->sig.length);
|
||||
}
|
||||
}
|
||||
|
||||
static void __str2dec(decimal* d, const char* s, short exp) {
|
||||
int i;
|
||||
|
||||
d->exp = exp;
|
||||
d->sign = 0;
|
||||
|
||||
for (i = 0; i < SIGDIGLEN && *s;) {
|
||||
d->sig.text[i++] = *s++ - '0';
|
||||
}
|
||||
d->sig.length = i;
|
||||
|
||||
if (*s != 0) {
|
||||
if (*s < 5)
|
||||
return;
|
||||
if (*s > 5)
|
||||
goto round;
|
||||
|
||||
{
|
||||
const char* p = s + 1;
|
||||
|
||||
for (; *p != 0; p++) {
|
||||
if (*p != '0')
|
||||
goto round;
|
||||
}
|
||||
|
||||
if ((d->sig.text[i - 1] & 1) == 0)
|
||||
return;
|
||||
}
|
||||
round:
|
||||
__dorounddecup(d, d->sig.length);
|
||||
}
|
||||
}
|
||||
|
||||
static void __two_exp(decimal* result, long exp) {
|
||||
switch (exp) {
|
||||
case -64:
|
||||
__str2dec(result, "542101086242752217003726400434970855712890625", -20);
|
||||
return;
|
||||
case -53:
|
||||
__str2dec(result, "11102230246251565404236316680908203125", -16);
|
||||
return;
|
||||
case -32:
|
||||
__str2dec(result, "23283064365386962890625", -10);
|
||||
return;
|
||||
case -16:
|
||||
__str2dec(result, "152587890625", -5);
|
||||
return;
|
||||
case -8:
|
||||
__str2dec(result, "390625", -3);
|
||||
return;
|
||||
case -7:
|
||||
__str2dec(result, "78125", -3);
|
||||
return;
|
||||
case -6:
|
||||
__str2dec(result, "15625", -2);
|
||||
return;
|
||||
case -5:
|
||||
__str2dec(result, "3125", -2);
|
||||
return;
|
||||
case -4:
|
||||
__str2dec(result, "625", -2);
|
||||
return;
|
||||
case -3:
|
||||
__str2dec(result, "125", -1);
|
||||
return;
|
||||
case -2:
|
||||
__str2dec(result, "25", -1);
|
||||
return;
|
||||
case -1:
|
||||
__str2dec(result, "5", -1);
|
||||
return;
|
||||
case 0:
|
||||
__str2dec(result, "1", 0);
|
||||
return;
|
||||
case 1:
|
||||
__str2dec(result, "2", 0);
|
||||
return;
|
||||
case 2:
|
||||
__str2dec(result, "4", 0);
|
||||
return;
|
||||
case 3:
|
||||
__str2dec(result, "8", 0);
|
||||
return;
|
||||
case 4:
|
||||
__str2dec(result, "16", 1);
|
||||
return;
|
||||
case 5:
|
||||
__str2dec(result, "32", 1);
|
||||
return;
|
||||
case 6:
|
||||
__str2dec(result, "64", 1);
|
||||
return;
|
||||
case 7:
|
||||
__str2dec(result, "128", 2);
|
||||
return;
|
||||
case 8:
|
||||
__str2dec(result, "256", 2);
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
decimal x2, temp;
|
||||
|
||||
__two_exp(&x2, exp / 2);
|
||||
__timesdec(result, &x2, &x2);
|
||||
|
||||
if (exp & 1) {
|
||||
temp = *result;
|
||||
if (exp > 0) {
|
||||
__str2dec(&x2, "2", 0);
|
||||
} else {
|
||||
__str2dec(&x2, "5", -1);
|
||||
}
|
||||
__timesdec(result, &temp, &x2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int __equals_dec(const decimal* x, const decimal* y) {
|
||||
if (x->sig.text[0] == 0) {
|
||||
return y->sig.text[0] == 0;
|
||||
}
|
||||
|
||||
if (y->sig.text[0] == 0) {
|
||||
return x->sig.text[0] == 0;
|
||||
}
|
||||
|
||||
if (x->exp == y->exp) {
|
||||
int i;
|
||||
int l = x->sig.length;
|
||||
|
||||
if (l > y->sig.length) {
|
||||
l = y->sig.length;
|
||||
}
|
||||
|
||||
for (i = 0; i < l; i++) {
|
||||
if (x->sig.text[i] != y->sig.text[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (l == x->sig.length) {
|
||||
x = y;
|
||||
}
|
||||
|
||||
for (; i < x->sig.length; i++) {
|
||||
if (x->sig.text[i] != 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __less_dec(const decimal* x, const decimal* y) {
|
||||
if (x->sig.text[0] == 0) {
|
||||
unsigned char leading_digit = y->sig.text[0];
|
||||
return ((unsigned long)(-leading_digit | leading_digit) >> 31);
|
||||
}
|
||||
|
||||
if (y->sig.text[0] == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (x->exp == y->exp) {
|
||||
int i;
|
||||
int l = x->sig.length;
|
||||
|
||||
if (l > y->sig.length) {
|
||||
l = y->sig.length;
|
||||
}
|
||||
|
||||
for (i = 0; i < l; i++) {
|
||||
if (x->sig.text[i] < y->sig.text[i]) {
|
||||
return 1;
|
||||
} else if (y->sig.text[i] < x->sig.text[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (l == x->sig.length) {
|
||||
for (; i < y->sig.length; i++) {
|
||||
if (y->sig.text[i] != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return x->exp < y->exp;
|
||||
}
|
||||
|
||||
static void __minus_dec(decimal* z, const decimal* x, const decimal* y) {
|
||||
int zlen, dexp;
|
||||
unsigned char *ib, *i, *ie;
|
||||
unsigned char const *jb, *j, *jn;
|
||||
|
||||
*z = *x;
|
||||
|
||||
if (y->sig.text[0] == 0)
|
||||
return;
|
||||
|
||||
zlen = z->sig.length;
|
||||
if (zlen < y->sig.length)
|
||||
zlen = y->sig.length;
|
||||
|
||||
dexp = z->exp - y->exp;
|
||||
zlen += dexp;
|
||||
|
||||
if (zlen > SIGDIGLEN)
|
||||
zlen = SIGDIGLEN;
|
||||
|
||||
while (z->sig.length < zlen) {
|
||||
z->sig.text[z->sig.length++] = 0;
|
||||
}
|
||||
|
||||
ib = z->sig.text;
|
||||
i = ib + zlen;
|
||||
|
||||
if (y->sig.length + dexp < zlen) {
|
||||
i = ib + (y->sig.length + dexp);
|
||||
}
|
||||
|
||||
jb = y->sig.text;
|
||||
j = jb + (i - ib - dexp);
|
||||
jn = j;
|
||||
|
||||
while (i > ib && j > jb) {
|
||||
i--;
|
||||
j--;
|
||||
if (*i < *j) {
|
||||
unsigned char* k = i - 1;
|
||||
while (*k == 0)
|
||||
k--;
|
||||
while (k != i) {
|
||||
--*k;
|
||||
*++k += 10;
|
||||
}
|
||||
}
|
||||
*i -= *j;
|
||||
}
|
||||
|
||||
if (jn - jb < y->sig.length) {
|
||||
int round_down = 0;
|
||||
if (*jn < 5)
|
||||
round_down = 1;
|
||||
else if (*jn == 5) {
|
||||
unsigned char const* ibPtr = y->sig.text + y->sig.length;
|
||||
|
||||
for (j = jn + 1; j < ibPtr; j++) {
|
||||
if (*j != 0)
|
||||
goto done;
|
||||
}
|
||||
i = ib + (jn - jb) + dexp - 1;
|
||||
if (*i & 1)
|
||||
round_down = 1;
|
||||
}
|
||||
if (round_down) {
|
||||
if (*i < 1) {
|
||||
unsigned char* k = i - 1;
|
||||
while (*k == 0)
|
||||
k--;
|
||||
while (k != i) {
|
||||
--*k;
|
||||
*++k += 10;
|
||||
}
|
||||
}
|
||||
*i -= 1;
|
||||
}
|
||||
}
|
||||
done:
|
||||
for (i = ib; *i == 0; ++i) {}
|
||||
|
||||
if (i > ib) {
|
||||
unsigned char dl = (unsigned char)(i - ib);
|
||||
z->exp -= dl;
|
||||
ie = ib + z->sig.length;
|
||||
for (; i < ie; ++i, ++ib)
|
||||
*ib = *i;
|
||||
z->sig.length -= dl;
|
||||
}
|
||||
|
||||
ib = z->sig.text;
|
||||
for (i = ib + z->sig.length; i > ib;) {
|
||||
i--;
|
||||
if (*i != 0)
|
||||
break;
|
||||
}
|
||||
z->sig.length = (unsigned char)(i - ib + 1);
|
||||
}
|
||||
|
||||
static void __num2dec_internal(decimal* d, double x) {
|
||||
signed char sign = (signed char)(__signbitd(x) != 0);
|
||||
|
||||
if (x == 0) {
|
||||
d->sign = sign;
|
||||
d->exp = 0;
|
||||
d->sig.length = 1;
|
||||
d->sig.text[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isfinite(x)) {
|
||||
d->sign = sign;
|
||||
d->exp = 0;
|
||||
d->sig.length = 1;
|
||||
d->sig.text[0] = fpclassify(x) == 1 ? 'N' : 'I';
|
||||
return;
|
||||
}
|
||||
|
||||
if (sign != 0) {
|
||||
x = -x;
|
||||
}
|
||||
|
||||
{
|
||||
int exp;
|
||||
double frac = frexp(x, &exp);
|
||||
int num_bits_extract = LDBL_MANT_DIG - __count_trailing_zero(frac);
|
||||
decimal int_d, pow2_d;
|
||||
|
||||
__two_exp(&pow2_d, exp - num_bits_extract);
|
||||
__ull2dec(&int_d, ldexp(frac, num_bits_extract));
|
||||
__timesdec(d, &int_d, &pow2_d);
|
||||
d->sign = sign;
|
||||
}
|
||||
}
|
||||
|
||||
void __num2dec(const decform* form, double x, decimal* d) {
|
||||
short digits = form->digits;
|
||||
int i;
|
||||
__num2dec_internal(d, x);
|
||||
|
||||
if (d->sig.text[0] > 9) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (digits > SIGDIGLEN) {
|
||||
digits = SIGDIGLEN;
|
||||
}
|
||||
|
||||
__rounddec(d, digits);
|
||||
|
||||
while (d->sig.length < digits) {
|
||||
d->sig.text[d->sig.length++] = 0;
|
||||
}
|
||||
|
||||
d->exp -= d->sig.length - 1;
|
||||
|
||||
for (i = 0; i < d->sig.length; i++) {
|
||||
d->sig.text[i] += '0';
|
||||
}
|
||||
}
|
||||
|
||||
double __dec2num(const decimal* d) {
|
||||
if (d->sig.length <= 0) {
|
||||
return copysign(0.0, d->sign == 0 ? 1.0 : -1.0);
|
||||
}
|
||||
|
||||
switch (d->sig.text[0]) {
|
||||
case '0':
|
||||
return copysign(0.0, d->sign == 0 ? 1.0 : -1.0);
|
||||
case 'I':
|
||||
return copysign((double)INFINITY, d->sign == 0 ? 1.0 : -1.0);
|
||||
case 'N': {
|
||||
double result;
|
||||
d_int* ll = (d_int*)&result;
|
||||
|
||||
*ll = 0x7FF0000000000000;
|
||||
if (d->sign)
|
||||
*ll |= 0x8000000000000000;
|
||||
*ll |= 0x8000000000000;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
static double pow_10[8] = {1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8};
|
||||
|
||||
decimal dec = *d;
|
||||
unsigned char* i = dec.sig.text;
|
||||
unsigned char* e = i + dec.sig.length;
|
||||
double first_guess;
|
||||
int exponent;
|
||||
|
||||
for (; i < e; ++i)
|
||||
*i -= '0';
|
||||
dec.exp += dec.sig.length - 1;
|
||||
exponent = dec.exp;
|
||||
|
||||
{
|
||||
decimal max;
|
||||
|
||||
__str2dec(&max, "179769313486231580793728714053034151", 308);
|
||||
if (__less_dec(&max, &dec)) {
|
||||
return copysign((double)INFINITY, d->sign == 0 ? 1.0 : -1.0);
|
||||
}
|
||||
}
|
||||
|
||||
i = dec.sig.text;
|
||||
first_guess = *i++;
|
||||
|
||||
while (i < e) {
|
||||
unsigned long ival = 0;
|
||||
int j;
|
||||
double temp1, temp2;
|
||||
int ndig = (int)(e - i) % 8;
|
||||
|
||||
if (ndig == 0)
|
||||
ndig = 8;
|
||||
|
||||
for (j = 0; j < ndig; ++j, ++i) {
|
||||
ival = ival * 10 + *i;
|
||||
}
|
||||
|
||||
temp1 = first_guess * pow_10[ndig - 1];
|
||||
temp2 = temp1 + ival;
|
||||
|
||||
if (ival != 0 && temp1 == temp2)
|
||||
break;
|
||||
|
||||
first_guess = temp2;
|
||||
exponent -= ndig;
|
||||
}
|
||||
|
||||
if (exponent < 0) {
|
||||
first_guess /= pow(5.0, -exponent);
|
||||
} else {
|
||||
first_guess *= pow(5.0, exponent);
|
||||
}
|
||||
|
||||
first_guess = ldexp(first_guess, exponent);
|
||||
|
||||
if (fpclassify(first_guess) == 2) {
|
||||
first_guess = LDBL_MAX;
|
||||
}
|
||||
|
||||
{
|
||||
decimal feedback1, feedback2, difflow, diffhigh;
|
||||
double next_guess;
|
||||
d_int* ull = (d_int*)&next_guess;
|
||||
int guessed_low = 0;
|
||||
|
||||
__num2dec_internal(&feedback1, first_guess);
|
||||
|
||||
if (__equals_dec(&feedback1, &dec)) {
|
||||
goto done;
|
||||
}
|
||||
if (__less_dec(&feedback1, &dec)) {
|
||||
guessed_low = 1;
|
||||
}
|
||||
|
||||
next_guess = first_guess;
|
||||
|
||||
while (1) {
|
||||
if (guessed_low) {
|
||||
++*ull;
|
||||
if (fpclassify(next_guess) == 2) {
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
--*ull;
|
||||
}
|
||||
|
||||
__num2dec_internal(&feedback2, next_guess);
|
||||
if (guessed_low && !__less_dec(&feedback2, &dec)) {
|
||||
break;
|
||||
} else if (!guessed_low && !__less_dec(&dec, &feedback2)) {
|
||||
difflow = feedback1;
|
||||
feedback1 = feedback2;
|
||||
feedback2 = difflow;
|
||||
{
|
||||
double temp = first_guess;
|
||||
first_guess = next_guess;
|
||||
next_guess = temp;
|
||||
}
|
||||
break;
|
||||
}
|
||||
feedback1 = feedback2;
|
||||
first_guess = next_guess;
|
||||
}
|
||||
|
||||
__minus_dec(&difflow, &dec, &feedback1);
|
||||
__minus_dec(&diffhigh, &feedback2, &dec);
|
||||
|
||||
if (__equals_dec(&difflow, &diffhigh)) {
|
||||
if (*(unsigned long long*)&first_guess & 1) {
|
||||
first_guess = next_guess;
|
||||
}
|
||||
} else if (!__less_dec(&difflow, &diffhigh)) {
|
||||
first_guess = next_guess;
|
||||
}
|
||||
}
|
||||
done:
|
||||
if (dec.sign) {
|
||||
first_guess = -first_guess;
|
||||
}
|
||||
return first_guess;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +93,7 @@ namespace nw4r {
|
||||
#else
|
||||
void SetTranslate(const math::VEC3& translate) { mTranslate = translate; }
|
||||
#endif
|
||||
#ifdef IPL_SDMEMORY_SET_TRANSLATE_OUT_OF_LINE
|
||||
void SetTranslate(const math::VEC2& translate);
|
||||
#else
|
||||
void SetTranslate(const math::VEC2& translate) { SetTranslate(math::VEC3(translate.x, translate.y, 0.0f)); }
|
||||
#endif
|
||||
|
||||
const math::VEC3& GetRotate() const { return mRotate; }
|
||||
void SetRotate(const math::VEC3& rotate) { mRotate = rotate; }
|
||||
|
||||
@@ -11,11 +11,7 @@ namespace nw4r {
|
||||
namespace snd {
|
||||
class SoundHandle : private ut::NonCopyable {
|
||||
public:
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
SoundHandle() NO_INLINE;
|
||||
#else
|
||||
SoundHandle() NO_INLINE : mSound(NULL) {}
|
||||
#endif
|
||||
~SoundHandle() { DetachSound(); }
|
||||
|
||||
void detail_AttachSound(detail::BasicSound* sound);
|
||||
|
||||
@@ -31,14 +31,7 @@ namespace nw4r {
|
||||
ut::detail::AutoLock<OSMutex> lock(mMutex);
|
||||
return mFrameHeap.SaveState();
|
||||
}
|
||||
#ifdef IPL_SOUND_MATCHING
|
||||
void LoadState(int id) {
|
||||
ut::detail::AutoLock<OSMutex> lock(mMutex);
|
||||
mFrameHeap.LoadState(id);
|
||||
}
|
||||
#else
|
||||
void LoadState(int id);
|
||||
#endif
|
||||
|
||||
bool IsValid() { return mFrameHeap.IsValid(); }
|
||||
|
||||
|
||||
@@ -14,13 +14,9 @@ namespace nw4r {
|
||||
#else
|
||||
Rect() : left(), top(), right(), bottom() {}
|
||||
#endif
|
||||
#ifdef IPL_SETTING_RECT_OUT_OF_LINE
|
||||
Rect(f32 l, f32 t, f32 r, f32 b);
|
||||
#else
|
||||
Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {}
|
||||
#endif
|
||||
|
||||
#if !defined(IPL_CONTROLLER_TRIVIAL_RECT_DTOR) && !defined(IPL_MEMORYCARD_BASE_CPP)
|
||||
#ifndef IPL_CONTROLLER_TRIVIAL_RECT_DTOR
|
||||
~Rect() {}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace nw4r {
|
||||
} // namespace detail
|
||||
|
||||
template <typename TDerived, typename TBase>
|
||||
#if defined(IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST) || defined(IPL_MEMORYCARD_BASE_CPP)
|
||||
#ifdef IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST
|
||||
TDerived DynamicCast(TBase* pPtr);
|
||||
#else
|
||||
inline TDerived DynamicCast(TBase* pPtr) {
|
||||
|
||||
@@ -106,15 +106,7 @@ typedef struct {
|
||||
u16 outputHeight; // 0x2A
|
||||
u32 convWidth; // 0x2C
|
||||
u32 convHeight; // 0x30
|
||||
#ifdef TMC_JPEG_PLANAR_OUTPUT
|
||||
u32 chromaWidth;
|
||||
u32 chromaHeight;
|
||||
u8* pLumaBuffer;
|
||||
u8* pCbBuffer;
|
||||
u8* pCrBuffer;
|
||||
#else
|
||||
u8 unk_0x34[0x14]; // 0x34
|
||||
#endif
|
||||
void* pTexBuffer; // 0x48
|
||||
u8 unk_0x4C[0x67C];
|
||||
TMCCJPEGDecWork* pWorkBuf; // 0x6C8
|
||||
|
||||
@@ -1,118 +1,13 @@
|
||||
#include <string.h>
|
||||
#include <tmc_jpeg_internal.h>
|
||||
|
||||
typedef struct {
|
||||
u16 bitLength;
|
||||
u16 symbol;
|
||||
} TMCHuffmanEntry;
|
||||
|
||||
static TMCHuffmanEntry readHuffmanEntry(const TMCHuffmanEntry* entries, u32 index) {
|
||||
return entries[index];
|
||||
}
|
||||
|
||||
static TMCHuffmanEntry readHuffmanLimit(const TMCHuffmanEntry* entries) {
|
||||
TMCHuffmanEntry limit;
|
||||
limit.bitLength = entries->bitLength;
|
||||
limit.symbol = entries->symbol;
|
||||
return limit;
|
||||
}
|
||||
|
||||
static inline s32 decodeLongHuffman(s32 bitCount, const TMCHuffmanEntry* table, const u8* symbols, TMCCJPEGDecWork* work) {
|
||||
u32 bitData;
|
||||
u32 code;
|
||||
u32 length;
|
||||
const TMCHuffmanEntry* entry;
|
||||
|
||||
if (bitCount <= 17) {
|
||||
s32 result = TMCJPEGDEC_load_buff(work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
bitCount = work->bitCount;
|
||||
bitData = work->bitBuf;
|
||||
bitCount -= 9;
|
||||
code = (bitData >> bitCount) & 0x1FF;
|
||||
work->bitCount = bitCount;
|
||||
length = 9;
|
||||
entry = table + 9;
|
||||
goto read_entry;
|
||||
while (1) {
|
||||
length++;
|
||||
entry++;
|
||||
if (length > 16) {
|
||||
return TMCC_ERROR_OVERFLOW;
|
||||
}
|
||||
bitCount = work->bitCount;
|
||||
code <<= 1;
|
||||
bitData = work->bitBuf;
|
||||
bitCount--;
|
||||
work->bitCount = bitCount;
|
||||
code |= (bitData >> bitCount) & 1;
|
||||
read_entry:
|
||||
{
|
||||
TMCHuffmanEntry decoded = readHuffmanLimit(entry);
|
||||
if (code > (u32)decoded.bitLength) {
|
||||
continue;
|
||||
}
|
||||
code = code - entry->bitLength + entry->symbol;
|
||||
return symbols[code & 0xFF];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline s32 decodeACHuffman(s32 bitCount, const TMCHuffmanEntry* entry, const u8* symbols, TMCCJPEGDecWork* work) {
|
||||
u32 bitData;
|
||||
u32 code;
|
||||
u32 length;
|
||||
|
||||
if (bitCount <= 17) {
|
||||
s32 result = TMCJPEGDEC_load_buff(work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
bitCount = work->bitCount;
|
||||
bitData = work->bitBuf;
|
||||
bitCount -= 9;
|
||||
code = (bitData >> bitCount) & 0x1FF;
|
||||
work->bitCount = bitCount;
|
||||
length = 9;
|
||||
entry += 9;
|
||||
goto read_entry;
|
||||
while (1) {
|
||||
length++;
|
||||
entry++;
|
||||
if (length > 16) {
|
||||
return TMCC_ERROR_OVERFLOW;
|
||||
}
|
||||
bitCount = work->bitCount;
|
||||
code <<= 1;
|
||||
bitData = work->bitBuf;
|
||||
bitCount--;
|
||||
work->bitCount = bitCount;
|
||||
code |= (bitData >> bitCount) & 1;
|
||||
read_entry:
|
||||
{
|
||||
TMCHuffmanEntry decoded = readHuffmanLimit(entry);
|
||||
if (code > (u32)decoded.bitLength) {
|
||||
continue;
|
||||
}
|
||||
code = code - entry->bitLength + entry->symbol;
|
||||
return symbols[code & 0xFF];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_ptr, TMCCJPEGDecWork* work) {
|
||||
TMCHuffmanEntry dcEntry;
|
||||
TMCHuffmanEntry acEntry;
|
||||
const TMCHuffmanEntry* ac_fast;
|
||||
volatile u32 ac_comb;
|
||||
u16* ac_fast;
|
||||
u8* huff_sym;
|
||||
u32* huff_tbl;
|
||||
s32 bit_pos;
|
||||
u32 bit_data;
|
||||
const TMCHuffmanEntry* dc_fast;
|
||||
u16* dc_fast;
|
||||
s32 r;
|
||||
s32 blk0;
|
||||
s32 idx;
|
||||
@@ -124,23 +19,29 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
|
||||
const u8* zztbl;
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
dc_fast = (const TMCHuffmanEntry*)work->pDCFast;
|
||||
dc_fast = work->pDCFast;
|
||||
|
||||
if (bit_pos <= 8) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
bit_pos = work->bitCount;
|
||||
}
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
bit_data = work->bitBuf;
|
||||
tmp = bit_pos - 8;
|
||||
tmp = ((bit_data >> tmp) & 0xFF) << 2;
|
||||
{
|
||||
dcEntry = readHuffmanEntry(dc_fast, tmp >> 2);
|
||||
r = dcEntry.bitLength;
|
||||
extra = dcEntry.symbol;
|
||||
u16* dc_entry = (u16*)((u8*)dc_fast + tmp);
|
||||
r = dc_entry[0];
|
||||
extra = dc_entry[1];
|
||||
}
|
||||
|
||||
{
|
||||
volatile u32 dc_comb;
|
||||
*(u16*)&dc_comb = r;
|
||||
*((u16*)&dc_comb + 1) = extra;
|
||||
}
|
||||
|
||||
if (r != 0) {
|
||||
@@ -148,9 +49,74 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
|
||||
work->bitCount = bit_pos;
|
||||
r = extra;
|
||||
} else {
|
||||
u32 code;
|
||||
unsigned int i;
|
||||
u16* entry;
|
||||
s32 thresh;
|
||||
s32 offs;
|
||||
|
||||
huff_sym = work->pDCHuffSym;
|
||||
huff_tbl = work->pDCHuffTbl;
|
||||
r = decodeLongHuffman(bit_pos, (const TMCHuffmanEntry*)huff_tbl, huff_sym, work);
|
||||
|
||||
if (bit_pos <= 17) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
bit_pos = work->bitCount;
|
||||
bit_data = work->bitBuf;
|
||||
bit_pos -= 9;
|
||||
code = (bit_data >> bit_pos) & 0x1FF;
|
||||
work->bitCount = bit_pos;
|
||||
|
||||
i = 9;
|
||||
entry = (u16*)((u8*)huff_tbl + 0x24);
|
||||
|
||||
goto dc_entry;
|
||||
|
||||
while (1) {
|
||||
i++;
|
||||
entry += 2;
|
||||
if (i > 16) {
|
||||
r = TMCC_ERROR_OVERFLOW;
|
||||
goto dc_end;
|
||||
}
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
code <<= 1;
|
||||
bit_data = work->bitBuf;
|
||||
bit_pos--;
|
||||
work->bitCount = bit_pos;
|
||||
code |= (bit_data >> bit_pos) & 1;
|
||||
|
||||
dc_entry:
|
||||
thresh = entry[0];
|
||||
offs = entry[1];
|
||||
|
||||
{
|
||||
volatile u16 p[2];
|
||||
p[0] = thresh;
|
||||
p[1] = offs;
|
||||
tmp = *(u32*)p;
|
||||
}
|
||||
|
||||
{
|
||||
volatile u32 cw;
|
||||
cw = tmp;
|
||||
thresh = *(u16*)&cw;
|
||||
}
|
||||
|
||||
if (code > (u32)thresh) {
|
||||
continue;
|
||||
}
|
||||
|
||||
code = code - entry[0] + offs;
|
||||
r = huff_sym[code & 0xFF];
|
||||
break;
|
||||
}
|
||||
|
||||
dc_end:
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
@@ -164,120 +130,203 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
|
||||
if (load_ret < 0) {
|
||||
return load_ret;
|
||||
}
|
||||
bit_pos = work->bitCount;
|
||||
}
|
||||
bit_pos = work->bitCount;
|
||||
bit_data = work->bitBuf;
|
||||
tmp = 1 << r;
|
||||
extra = tmp - 1;
|
||||
bit_pos -= r;
|
||||
work->bitCount = bit_pos;
|
||||
extra = extra & (bit_data >> bit_pos);
|
||||
if (((s32)tmp >> 1) > extra) {
|
||||
extra -= tmp - 1;
|
||||
if ((s32)tmp >> 1 <= extra) {
|
||||
extra = extra;
|
||||
} else {
|
||||
extra = extra - (tmp - 1);
|
||||
}
|
||||
dc_predict_row_ptr[0] += extra;
|
||||
}
|
||||
|
||||
*block = dc_predict_row_ptr[0] * blk0;
|
||||
|
||||
ac_fast = work->pACFast;
|
||||
huff_tbl = work->pACHuffTbl;
|
||||
huff_sym = work->pACHuffSym;
|
||||
|
||||
memset((u8*)block + 4, 0, 0xFC);
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
idx = 1;
|
||||
if (bit_pos <= 8) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
zztbl = TMCJPEGDEC_Zigzag_data;
|
||||
bit_data = work->bitBuf;
|
||||
t = bit_pos - 8;
|
||||
{
|
||||
ac_fast = (const TMCHuffmanEntry*)work->pACFast;
|
||||
huff_tbl = work->pACHuffTbl;
|
||||
huff_sym = work->pACHuffSym;
|
||||
u32 tbl_idx = ((bit_data >> t) & 0xFF) << 2;
|
||||
s32 thresh_val = ac_fast[tbl_idx >> 1];
|
||||
s32 offs_val = *(u16*)((u8*)ac_fast + tbl_idx + 2);
|
||||
*(u16*)&ac_comb = thresh_val;
|
||||
*((u16*)&ac_comb + 1) = offs_val;
|
||||
}
|
||||
|
||||
memset(block + 1, 0, 0xFC);
|
||||
while (idx < 64) {
|
||||
s32 ac_thresh = *(u16*)&ac_comb;
|
||||
if (ac_thresh != 0) {
|
||||
bit_pos = work->bitCount;
|
||||
bit_pos -= ac_thresh;
|
||||
work->bitCount = bit_pos;
|
||||
r = *((u16*)&ac_comb + 1);
|
||||
} else {
|
||||
u32 code;
|
||||
unsigned int i;
|
||||
u16* entry;
|
||||
s32 thresh;
|
||||
s32 offs;
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
idx = 1;
|
||||
if (bit_pos <= 8) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0)
|
||||
bit_pos = work->bitCount;
|
||||
if (bit_pos <= 17) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
bit_pos = work->bitCount;
|
||||
}
|
||||
bit_data = work->bitBuf;
|
||||
bit_pos -= 9;
|
||||
code = (bit_data >> bit_pos) & 0x1FF;
|
||||
work->bitCount = bit_pos;
|
||||
|
||||
i = 9;
|
||||
entry = (u16*)((u8*)work->pACHuffTbl + 0x24);
|
||||
|
||||
goto ac_entry_huff;
|
||||
|
||||
while (1) {
|
||||
i++;
|
||||
entry += 2;
|
||||
if (i > 16) {
|
||||
r = TMCC_ERROR_OVERFLOW;
|
||||
goto ac_end;
|
||||
}
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
code <<= 1;
|
||||
bit_data = work->bitBuf;
|
||||
bit_pos--;
|
||||
work->bitCount = bit_pos;
|
||||
code |= (bit_data >> bit_pos) & 1;
|
||||
|
||||
ac_entry_huff:
|
||||
thresh = entry[0];
|
||||
offs = entry[1];
|
||||
|
||||
{
|
||||
volatile u16 p[2];
|
||||
p[0] = thresh;
|
||||
p[1] = offs;
|
||||
tmp = *(u32*)p;
|
||||
}
|
||||
|
||||
{
|
||||
volatile u32 cw;
|
||||
cw = tmp;
|
||||
thresh = *(u16*)&cw;
|
||||
}
|
||||
|
||||
if (code > (u32)thresh) {
|
||||
continue;
|
||||
}
|
||||
|
||||
code = code - entry[0] + offs;
|
||||
r = huff_sym[code & 0xFF];
|
||||
break;
|
||||
}
|
||||
|
||||
ac_end:
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
zztbl = TMCJPEGDEC_Zigzag_data;
|
||||
bit_data = work->bitBuf;
|
||||
t = bit_pos - 8;
|
||||
acEntry = readHuffmanEntry(ac_fast, (bit_data >> t) & 0xFF);
|
||||
t = r & 0x0F;
|
||||
if (t != 0) {
|
||||
r >>= 4;
|
||||
idx += r;
|
||||
|
||||
do {
|
||||
s32 ac_thresh = acEntry.bitLength;
|
||||
if (ac_thresh != 0) {
|
||||
if (idx >= 64) {
|
||||
return TMCC_ERROR_OVERFLOW;
|
||||
}
|
||||
|
||||
zz = zztbl[idx];
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
if (bit_pos <= t + 8) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
bit_pos = work->bitCount;
|
||||
bit_pos -= ac_thresh;
|
||||
work->bitCount = bit_pos;
|
||||
r = acEntry.symbol;
|
||||
}
|
||||
tmp = 1 << t;
|
||||
bit_data = work->bitBuf;
|
||||
extra = tmp - 1;
|
||||
bit_pos -= t;
|
||||
work->bitCount = bit_pos;
|
||||
t = bit_pos - 8;
|
||||
{
|
||||
u32 next_tbl = ((bit_data >> t) & 0xFF) << 2;
|
||||
s32 next_th = ac_fast[next_tbl >> 1];
|
||||
s32 next_of = *(u16*)((u8*)ac_fast + next_tbl + 2);
|
||||
extra = extra & (bit_data >> bit_pos);
|
||||
*(u16*)&ac_comb = next_th;
|
||||
*((u16*)&ac_comb + 1) = next_of;
|
||||
}
|
||||
|
||||
if ((s32)tmp >> 1 <= extra) {
|
||||
extra = extra;
|
||||
} else {
|
||||
bit_pos = work->bitCount;
|
||||
r = decodeACHuffman(bit_pos, (const TMCHuffmanEntry*)huff_tbl, huff_sym, work);
|
||||
extra = extra - (tmp - 1);
|
||||
}
|
||||
|
||||
q = ((s32*)conv_row_ptr)[zz];
|
||||
block[zz] = extra * q;
|
||||
|
||||
idx++;
|
||||
} else {
|
||||
if (r == 0) {
|
||||
break;
|
||||
}
|
||||
bit_pos = work->bitCount;
|
||||
if (bit_pos <= 8) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
t = r & 0x0F;
|
||||
if (t != 0) {
|
||||
r >>= 4;
|
||||
idx += r;
|
||||
|
||||
if (idx >= 64) {
|
||||
return TMCC_ERROR_OVERFLOW;
|
||||
}
|
||||
|
||||
zz = zztbl[idx];
|
||||
|
||||
bit_pos = work->bitCount;
|
||||
if (bit_pos <= t + 8) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
bit_pos = work->bitCount;
|
||||
tmp = 1 << t;
|
||||
bit_data = work->bitBuf;
|
||||
extra = tmp - 1;
|
||||
bit_pos -= t;
|
||||
work->bitCount = bit_pos;
|
||||
t = bit_pos - 8;
|
||||
extra = extra & (bit_data >> bit_pos);
|
||||
q = ((s32*)conv_row_ptr)[(u8)zz];
|
||||
acEntry = readHuffmanEntry(ac_fast, (bit_data >> t) & 0xFF);
|
||||
|
||||
if (((s32)tmp >> 1) > extra) {
|
||||
extra -= tmp - 1;
|
||||
}
|
||||
|
||||
block[(u8)zz] = extra * q;
|
||||
|
||||
idx++;
|
||||
} else {
|
||||
if (r == 0) {
|
||||
break;
|
||||
}
|
||||
bit_pos = work->bitCount;
|
||||
if (bit_pos <= 8) {
|
||||
r = TMCJPEGDEC_load_buff(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
bit_data = work->bitBuf;
|
||||
bit_pos = work->bitCount;
|
||||
t = bit_pos - 8;
|
||||
tmp = ((bit_data >> t) & 0xFF) << 2;
|
||||
acEntry = readHuffmanEntry(ac_fast, tmp >> 2);
|
||||
|
||||
idx += 16;
|
||||
bit_data = work->bitBuf;
|
||||
bit_pos = work->bitCount;
|
||||
t = bit_pos - 8;
|
||||
tmp = ((bit_data >> t) & 0xFF) << 2;
|
||||
{
|
||||
s32 next_thresh = ac_fast[tmp >> 1];
|
||||
s32 next_offs = *(u16*)((u8*)ac_fast + tmp + 2);
|
||||
*(u16*)&ac_comb = next_thresh;
|
||||
*((u16*)&ac_comb + 1) = next_offs;
|
||||
}
|
||||
} while (idx < 64);
|
||||
|
||||
if (idx > 64) {
|
||||
return TMCC_ERROR_OVERFLOW;
|
||||
idx += 16;
|
||||
}
|
||||
|
||||
idx--;
|
||||
return TMCJPEGDEC_Zigzag_loop[idx];
|
||||
}
|
||||
|
||||
if (idx > 64) {
|
||||
return TMCC_ERROR_OVERFLOW;
|
||||
}
|
||||
|
||||
idx--;
|
||||
return TMCJPEGDEC_Zigzag_loop[idx];
|
||||
}
|
||||
|
||||
@@ -1,28 +1,26 @@
|
||||
#include <string.h>
|
||||
#include <tmc_jpeg_internal.h>
|
||||
|
||||
static s32 clampU8(s32 v) {
|
||||
static u8 clampU8(s32 v) {
|
||||
s32 ok;
|
||||
ok = 0;
|
||||
if (v < 256 && v > -1) {
|
||||
ok = 1;
|
||||
}
|
||||
return ok ? v : (v < 0 ? 0 : 255);
|
||||
return (ok) ? v : ((v < 0) ? 0 : 255);
|
||||
}
|
||||
|
||||
static s32 clampS8(s32 v) {
|
||||
s32 inRange = 0;
|
||||
if (v < 128 && v > -129) {
|
||||
inRange = 1;
|
||||
}
|
||||
return inRange ? v : (v > 0) ? 127 : -128;
|
||||
static s8 clampS8(s32 v) {
|
||||
return (v < 128 && v > -129) ? (s8)v : (v > 0) ? 127 : -128;
|
||||
}
|
||||
|
||||
static s32 scalingClampU8(s32 value) {
|
||||
if ((value >> 19) == 0) {
|
||||
return value >> 11;
|
||||
}
|
||||
return value < 0 ? 0 : 255;
|
||||
static s32 scalingClampU8(s32 val) {
|
||||
s32 result = 0;
|
||||
if (val >> 19 != 0)
|
||||
result &= ~(val >> 31) & 0xFF;
|
||||
else
|
||||
result = (val >> 11);
|
||||
return result;
|
||||
}
|
||||
|
||||
void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag) {
|
||||
@@ -31,39 +29,17 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
|
||||
s32 done;
|
||||
s32 iter;
|
||||
s32 i;
|
||||
s32 e;
|
||||
s32 b2;
|
||||
s32 b3;
|
||||
s32 b4;
|
||||
s32 b5;
|
||||
s32 b6;
|
||||
s32 b7;
|
||||
s32 v;
|
||||
s32 m;
|
||||
s32 a;
|
||||
s32 d;
|
||||
s32 z;
|
||||
s32 o;
|
||||
s32 p;
|
||||
s32 p_part;
|
||||
s32 t;
|
||||
s32 u;
|
||||
s32 r;
|
||||
s32 n;
|
||||
s32 y;
|
||||
s32 x_factor;
|
||||
s32 z_factor;
|
||||
s32 m_part;
|
||||
s32 q;
|
||||
s32 w;
|
||||
s32 x;
|
||||
s32 b1;
|
||||
s32 b1, b2, b3, b4, b5, b6, b7;
|
||||
s32 v, e, a, d, n, o, p, q, t, u, w, x, y;
|
||||
s32 x_factor, z_factor, m_part, p_part;
|
||||
s32 r, z, m;
|
||||
|
||||
r = (zigzag >> 4) * 8;
|
||||
iter = (u32)(r + 7) >> 3;
|
||||
dst = tmp;
|
||||
done = 0;
|
||||
{
|
||||
for (; done < r; done += 8) {
|
||||
if (r > 0) {
|
||||
for (; iter > 0; iter--) {
|
||||
u32 ac;
|
||||
b4 = block[4];
|
||||
b6 = block[6];
|
||||
@@ -73,13 +49,7 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
|
||||
b5 = block[5];
|
||||
b3 = block[3];
|
||||
|
||||
ac = (u32)b4;
|
||||
ac |= (u32)b6;
|
||||
ac |= (u32)b2;
|
||||
ac |= (u32)b1;
|
||||
ac |= (u32)b7;
|
||||
ac |= (u32)b5;
|
||||
ac |= (u32)b3;
|
||||
ac = (u32)b4 | (u32)b6 | (u32)b2 | (u32)b1 | (u32)b7 | (u32)b5 | (u32)b3;
|
||||
if (ac == 0) {
|
||||
s32 val = block[0];
|
||||
dst[7] = val;
|
||||
@@ -91,39 +61,23 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
|
||||
dst[1] = val;
|
||||
dst[0] = val;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddHighSum;
|
||||
s32 dcValue;
|
||||
|
||||
t = b2 - b6;
|
||||
oddLowSum = b5 + b3;
|
||||
b5 = b5 - b3;
|
||||
oddHighSum = b1 + b7;
|
||||
b1 = b1 - b7;
|
||||
u = b6 + b2;
|
||||
t = t * 0xB5 >> 8;
|
||||
x_factor = oddHighSum - oddLowSum;
|
||||
z_factor = b5 + b1;
|
||||
dcValue = block[0];
|
||||
a = dcValue - b4;
|
||||
x = x_factor * 0xB5 >> 8;
|
||||
d = dcValue + b4;
|
||||
u = t + u;
|
||||
t = (b2 - b6) * 0xB5 >> 8;
|
||||
a = block[0] - b4;
|
||||
d = block[0] + b4;
|
||||
u = t + b6 + b2;
|
||||
v = a + t;
|
||||
z = z_factor * 0x62 >> 8;
|
||||
w = d + u;
|
||||
y = d - u;
|
||||
m_part = b1 * 0x14E >> 8;
|
||||
e = a - t;
|
||||
w = d + u;
|
||||
x_factor = (b1 + b7) - (b5 + b3);
|
||||
y = d - u;
|
||||
z_factor = (b5 - b3) + (b1 - b7);
|
||||
m_part = (b1 - b7) * 0x14E >> 8;
|
||||
p_part = (b5 - b3) * 0x8B >> 8;
|
||||
x = x_factor * 0xB5 >> 8;
|
||||
z = z_factor * 0x62 >> 8;
|
||||
m = m_part - z;
|
||||
oddLowSum += m;
|
||||
n = oddHighSum + oddLowSum;
|
||||
n = b1 + b7 + b5 + b3 + m;
|
||||
o = x + m;
|
||||
dst[0] = w + n;
|
||||
p_part = b5 * 0x8B;
|
||||
dst[7] = w - n;
|
||||
p_part >>= 8;
|
||||
dst[1] = v + o;
|
||||
p = z + p_part;
|
||||
q = p + x;
|
||||
dst[6] = v - o;
|
||||
@@ -134,11 +88,12 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
|
||||
}
|
||||
block += 8;
|
||||
dst += 8;
|
||||
done += 8;
|
||||
}
|
||||
}
|
||||
|
||||
dst = tmp + done;
|
||||
for (; done <= 0x38; done += 8) {
|
||||
for (; done < 0x38; done += 8) {
|
||||
memset(dst, 0, 0x20);
|
||||
dst += 8;
|
||||
}
|
||||
@@ -159,13 +114,7 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
|
||||
b5 = dst[0x28];
|
||||
b3 = dst[0x18];
|
||||
|
||||
ac = (u32)b4;
|
||||
ac |= (u32)b6;
|
||||
ac |= (u32)b2;
|
||||
ac |= (u32)b1;
|
||||
ac |= (u32)b7;
|
||||
ac |= (u32)b5;
|
||||
ac |= (u32)b3;
|
||||
ac = (u32)b4 | (u32)b6 | (u32)b2 | (u32)b1 | (u32)b7 | (u32)b5 | (u32)b3;
|
||||
out = conv_row_ptr + i;
|
||||
if (ac == 0) {
|
||||
u8 val = clampU8((*dst >> 11) + 0x80);
|
||||
@@ -178,37 +127,24 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
|
||||
out[pitch] = val;
|
||||
out[0] = val;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddHighSum;
|
||||
s32 dcValue;
|
||||
|
||||
t = b2 - b6;
|
||||
oddLowSum = b5 + b3;
|
||||
b5 = b5 - b3;
|
||||
oddHighSum = b1 + b7;
|
||||
b1 = b1 - b7;
|
||||
u = b6 + b2;
|
||||
b2 = t * 0xB5 >> 8;
|
||||
x_factor = oddHighSum - oddLowSum;
|
||||
z_factor = b5 + b1;
|
||||
dcValue = *dst + 0x40000;
|
||||
a = dcValue - b4;
|
||||
x = x_factor * 0xB5 >> 8;
|
||||
d = dcValue + b4;
|
||||
u = b2 + u;
|
||||
v = a + b2;
|
||||
z_factor = z_factor * 0x62 >> 8;
|
||||
t = (b2 - b6) * 0xB5 >> 8;
|
||||
a = *dst - b4;
|
||||
d = *dst + b4;
|
||||
u = t + b6 + b2;
|
||||
v = a + t;
|
||||
e = a - t;
|
||||
w = d + u;
|
||||
x = ((b1 + b7) - (b5 + b3)) * 0xB5 >> 8;
|
||||
y = d - u;
|
||||
m_part = b1 * 0x14E >> 8;
|
||||
e = a - b2;
|
||||
m_part = m_part - z_factor;
|
||||
oddLowSum += m_part;
|
||||
n = oddHighSum + oddLowSum;
|
||||
|
||||
z_factor = ((b5 - b3) + (b1 - b7)) * 0x62 >> 8;
|
||||
m_part = ((b1 - b7) * 0x14E >> 8) - z_factor;
|
||||
|
||||
n = b1 + b7 + b5 + b3 + m_part;
|
||||
o = x + m_part;
|
||||
p_part = b5 * 0x8B >> 8;
|
||||
p = z_factor + p_part;
|
||||
p = z_factor + ((b5 - b3) * 0x8B >> 8);
|
||||
q = p + x;
|
||||
|
||||
out[0] = scalingClampU8(w + n);
|
||||
out[r] = scalingClampU8(w - n);
|
||||
out[pitch] = scalingClampU8(v + o);
|
||||
@@ -227,34 +163,11 @@ void TMCJPEGDEC_IdctBlock_Col(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigza
|
||||
s32* dst;
|
||||
s32 done;
|
||||
s32 iter;
|
||||
s32 d;
|
||||
s32 b1;
|
||||
s32 b2;
|
||||
s32 b3;
|
||||
s32 b4;
|
||||
s32 b5;
|
||||
s32 b6;
|
||||
s32 b7;
|
||||
s32 v;
|
||||
s32 r;
|
||||
s32 a;
|
||||
s32 i;
|
||||
s32 m;
|
||||
s32 n;
|
||||
s32 o;
|
||||
s32 x;
|
||||
s32 q;
|
||||
s32 y;
|
||||
s32 u;
|
||||
s32 w;
|
||||
s32 p;
|
||||
s32 t;
|
||||
s32 z;
|
||||
s32 x_factor;
|
||||
s32 z_factor;
|
||||
s32 m_part;
|
||||
s32 p_part;
|
||||
s32 e;
|
||||
s32 b1, b2, b3, b4, b5, b6, b7;
|
||||
s32 v, e, a, d, m, n, o, p, q, t, u, w, x, y, z;
|
||||
s32 x_factor, z_factor, m_part, p_part;
|
||||
s32 r;
|
||||
|
||||
if (zigzag == 0x11) {
|
||||
s32 val;
|
||||
@@ -268,42 +181,90 @@ void TMCJPEGDEC_IdctBlock_Col(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigza
|
||||
goto mode_gt_2;
|
||||
}
|
||||
|
||||
dst = tmp;
|
||||
done = 0;
|
||||
for (; done < r; done += 8) {
|
||||
s32 dcValue;
|
||||
s32 oddCoefficient;
|
||||
{
|
||||
s32 inner;
|
||||
|
||||
oddCoefficient = block[1];
|
||||
dcValue = block[0];
|
||||
t = oddCoefficient * 0xB5 >> 8;
|
||||
v = oddCoefficient * 0x62 >> 8;
|
||||
u = v + t;
|
||||
z = (oddCoefficient * 0x14E >> 8) - v;
|
||||
m = oddCoefficient + z;
|
||||
n = t + z;
|
||||
dst[0] = dcValue + m;
|
||||
dst[7] = dcValue - m;
|
||||
dst[1] = dcValue + n;
|
||||
dst[6] = dcValue - n;
|
||||
dst[2] = dcValue + u;
|
||||
dst[5] = dcValue - u;
|
||||
dst[3] = dcValue + v;
|
||||
dst[4] = dcValue - v;
|
||||
dst += 8;
|
||||
block += 8;
|
||||
}
|
||||
dst = tmp + done;
|
||||
for (; done <= 0x38; done += 8) {
|
||||
memset(dst, 0, 0x20);
|
||||
dst += 8;
|
||||
dst = tmp;
|
||||
done = 0;
|
||||
iter = (r + 7) >> 3;
|
||||
if (r > 0) {
|
||||
inner = (r + 7) >> 4;
|
||||
done = iter << 3;
|
||||
if (inner != 0) {
|
||||
for (; inner > 0; inner--) {
|
||||
t = block[1] * 0xB5 >> 8;
|
||||
v = block[1] * 0x62 >> 8;
|
||||
u = v + t;
|
||||
z = (block[1] * 0x14E >> 8) - v;
|
||||
m = block[1] + z;
|
||||
n = t + z;
|
||||
b1 = block[0] + m;
|
||||
dst[0] = b1;
|
||||
dst[7] = block[0] - m;
|
||||
dst[1] = block[0] + n;
|
||||
dst[6] = block[0] - n;
|
||||
dst[2] = block[0] + u;
|
||||
dst[5] = block[0] - u;
|
||||
dst[3] = block[0] + v;
|
||||
dst[4] = block[0] - v;
|
||||
|
||||
t = block[9] * 0xB5 >> 8;
|
||||
v = block[9] * 0x62 >> 8;
|
||||
u = v + t;
|
||||
z = (block[9] * 0x14E >> 8) - v;
|
||||
m = block[9] + z;
|
||||
n = t + z;
|
||||
b2 = block[8] + m;
|
||||
dst[8] = b2;
|
||||
dst[15] = block[8] - m;
|
||||
dst[9] = block[8] + n;
|
||||
dst[14] = block[8] - n;
|
||||
dst[10] = block[8] + u;
|
||||
dst[13] = block[8] - u;
|
||||
dst[11] = block[8] + v;
|
||||
dst[12] = block[8] - v;
|
||||
dst += 0x10;
|
||||
block += 0x10;
|
||||
}
|
||||
iter = iter & 1;
|
||||
if (iter == 0) {
|
||||
goto zero_fill;
|
||||
}
|
||||
}
|
||||
for (; iter > 0; iter--) {
|
||||
t = block[1] * 0xB5 >> 8;
|
||||
v = block[1] * 0x62 >> 8;
|
||||
u = v + t;
|
||||
z = (block[1] * 0x14E >> 8) - v;
|
||||
m = block[1] + z;
|
||||
n = t + z;
|
||||
b1 = block[0] + m;
|
||||
dst[0] = b1;
|
||||
dst[7] = block[0] - m;
|
||||
dst[1] = block[0] + n;
|
||||
dst[6] = block[0] - n;
|
||||
dst[2] = block[0] + u;
|
||||
dst[5] = block[0] - u;
|
||||
dst[3] = block[0] + v;
|
||||
dst[4] = block[0] - v;
|
||||
dst += 8;
|
||||
block += 8;
|
||||
}
|
||||
}
|
||||
zero_fill:
|
||||
dst = tmp + done;
|
||||
for (; done < 0x39; done += 8) {
|
||||
memset(dst, 0, 0x20);
|
||||
dst += 8;
|
||||
}
|
||||
}
|
||||
goto epilogue;
|
||||
|
||||
mode_gt_2:
|
||||
dst = tmp;
|
||||
done = 0;
|
||||
for (; done < r; done += 8) {
|
||||
if (r > 0) {
|
||||
for (iter = (r + 7) >> 3; iter > 0; iter--) {
|
||||
u32 ac;
|
||||
b4 = block[4];
|
||||
b6 = block[6];
|
||||
@@ -332,41 +293,23 @@ mode_gt_2:
|
||||
dst[1] = val;
|
||||
dst[0] = val;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddLowDifference;
|
||||
s32 oddHighSum;
|
||||
s32 oddHighDifference;
|
||||
s32 dcValue;
|
||||
|
||||
t = b2 - b6;
|
||||
oddLowSum = b5 + b3;
|
||||
oddLowDifference = b5 - b3;
|
||||
oddHighSum = b1 + b7;
|
||||
oddHighDifference = b1 - b7;
|
||||
u = b6 + b2;
|
||||
t = t * 0xB5 >> 8;
|
||||
x_factor = oddHighSum - oddLowSum;
|
||||
z_factor = oddLowDifference + oddHighDifference;
|
||||
dcValue = block[0];
|
||||
a = dcValue - b4;
|
||||
x = x_factor * 0xB5 >> 8;
|
||||
d = dcValue + b4;
|
||||
u = t + u;
|
||||
t = (b2 - b6) * 0xB5 >> 8;
|
||||
a = block[0] - b4;
|
||||
d = block[0] + b4;
|
||||
u = t + b6 + b2;
|
||||
v = a + t;
|
||||
z = z_factor * 0x62 >> 8;
|
||||
w = d + u;
|
||||
y = d - u;
|
||||
m_part = oddHighDifference * 0x14E >> 8;
|
||||
e = a - t;
|
||||
w = d + u;
|
||||
x_factor = (b1 + b7) - (b5 + b3);
|
||||
y = d - u;
|
||||
z_factor = (b5 - b3) + (b1 - b7);
|
||||
m_part = (b1 - b7) * 0x14E >> 8;
|
||||
p_part = (b5 - b3) * 0x8B >> 8;
|
||||
x = x_factor * 0xB5 >> 8;
|
||||
z = z_factor * 0x62 >> 8;
|
||||
m = m_part - z;
|
||||
oddLowSum += m;
|
||||
n = oddHighSum + oddLowSum;
|
||||
n = b1 + b7 + b5 + b3 + m;
|
||||
o = x + m;
|
||||
dst[0] = w + n;
|
||||
p_part = oddLowDifference * 0x8B;
|
||||
dst[7] = w - n;
|
||||
p_part >>= 8;
|
||||
dst[1] = v + o;
|
||||
p = z + p_part;
|
||||
q = p + x;
|
||||
dst[6] = v - o;
|
||||
@@ -377,10 +320,12 @@ mode_gt_2:
|
||||
}
|
||||
block += 8;
|
||||
dst += 8;
|
||||
done += 8;
|
||||
}
|
||||
}
|
||||
|
||||
dst = tmp + done;
|
||||
for (; done <= 0x38; done += 8) {
|
||||
for (; done < 0x39; done += 8) {
|
||||
memset(dst, 0, 0x20);
|
||||
dst += 8;
|
||||
}
|
||||
@@ -390,9 +335,7 @@ epilogue:
|
||||
dst = tmp + 7;
|
||||
for (iter = 8, i = 7; iter > 0; iter--, i--) {
|
||||
u32 ac;
|
||||
u8* output;
|
||||
b4 = dst[0x20];
|
||||
output = conv_row_ptr + i;
|
||||
b6 = dst[0x30];
|
||||
b2 = dst[0x10];
|
||||
b1 = dst[8];
|
||||
@@ -410,56 +353,40 @@ epilogue:
|
||||
if (ac == 0) {
|
||||
s32 val;
|
||||
val = clampS8(*dst >> 11);
|
||||
output[56] = (u8)val;
|
||||
output[48] = (u8)val;
|
||||
output[40] = (u8)val;
|
||||
output[32] = (u8)val;
|
||||
output[24] = (u8)val;
|
||||
output[16] = (u8)val;
|
||||
output[8] = (u8)val;
|
||||
output[0] = (u8)val;
|
||||
conv_row_ptr[i + 56] = (u8)val;
|
||||
conv_row_ptr[i + 48] = (u8)val;
|
||||
conv_row_ptr[i + 40] = (u8)val;
|
||||
conv_row_ptr[i + 32] = (u8)val;
|
||||
conv_row_ptr[i + 24] = (u8)val;
|
||||
conv_row_ptr[i + 16] = (u8)val;
|
||||
conv_row_ptr[i + 8] = (u8)val;
|
||||
conv_row_ptr[i] = (u8)val;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddLowDifference;
|
||||
s32 oddHighSum;
|
||||
s32 oddHighDifference;
|
||||
s32 dcValue;
|
||||
|
||||
t = b2 - b6;
|
||||
oddLowSum = b5 + b3;
|
||||
oddLowDifference = b5 - b3;
|
||||
oddHighSum = b1 + b7;
|
||||
oddHighDifference = b1 - b7;
|
||||
u = b6 + b2;
|
||||
t = t * 0xB5 >> 8;
|
||||
x_factor = oddHighSum - oddLowSum;
|
||||
z_factor = oddLowDifference + oddHighDifference;
|
||||
dcValue = *dst;
|
||||
a = dcValue - b4;
|
||||
x = x_factor * 0xB5 >> 8;
|
||||
d = dcValue + b4;
|
||||
u = t + u;
|
||||
t = (b2 - b6) * 0xB5 >> 8;
|
||||
a = *dst - b4;
|
||||
d = *dst + b4;
|
||||
u = t + b6 + b2;
|
||||
v = a + t;
|
||||
z = z_factor * 0x62 >> 8;
|
||||
w = d + u;
|
||||
y = d - u;
|
||||
m_part = oddHighDifference * 0x14E >> 8;
|
||||
e = a - t;
|
||||
m = m_part - z;
|
||||
oddLowSum += m;
|
||||
n = oddHighSum + oddLowSum;
|
||||
w = d + u;
|
||||
x = ((b1 + b7) - (b5 + b3)) * 0xB5 >> 8;
|
||||
y = d - u;
|
||||
z = ((b5 - b3) + (b1 - b7)) * 0x62 >> 8;
|
||||
m = ((b1 - b7) * 0x14E >> 8) - z;
|
||||
n = b1 + b7 + b5 + b3 + m;
|
||||
o = x + m;
|
||||
p_part = oddLowDifference * 0x8B >> 8;
|
||||
p = z + p_part;
|
||||
|
||||
p = z + ((b5 - b3) * 0x8B >> 8);
|
||||
q = p + x;
|
||||
output[0] = (u8)clampS8((w + n) >> 11);
|
||||
output[56] = (u8)clampS8((w - n) >> 11);
|
||||
output[8] = (u8)clampS8((v + o) >> 11);
|
||||
output[48] = (u8)clampS8((v - o) >> 11);
|
||||
output[16] = (u8)clampS8((e + q) >> 11);
|
||||
output[40] = (u8)clampS8((e - q) >> 11);
|
||||
output[24] = (u8)clampS8((y + p) >> 11);
|
||||
output[32] = (u8)clampS8((y - p) >> 11);
|
||||
|
||||
conv_row_ptr[i] = (u8)clampS8((w + n) >> 11);
|
||||
conv_row_ptr[i + 56] = (u8)clampS8((w - n) >> 11);
|
||||
conv_row_ptr[i + 8] = (u8)clampS8((v + o) >> 11);
|
||||
conv_row_ptr[i + 48] = (u8)clampS8((v - o) >> 11);
|
||||
conv_row_ptr[i + 16] = (u8)clampS8((e + q) >> 11);
|
||||
conv_row_ptr[i + 40] = (u8)clampS8((e - q) >> 11);
|
||||
conv_row_ptr[i + 24] = (u8)clampS8((y + p) >> 11);
|
||||
conv_row_ptr[i + 32] = (u8)clampS8((y - p) >> 11);
|
||||
}
|
||||
dst--;
|
||||
}
|
||||
|
||||
@@ -15,16 +15,9 @@ static u16 readU16(const u8* p, u16 byteOrder) {
|
||||
return (u16)(raw >> 8 & 0xFF | (raw & 0xFF) << 8);
|
||||
}
|
||||
|
||||
static u16 readExifU16(const u8* data, u16 byteOrder) {
|
||||
u32 value = data[0] | data[1] << 8;
|
||||
if (byteOrder == 0x4949) {
|
||||
return (u16)value;
|
||||
}
|
||||
return (u16)(value >> 8 & 255 | (value & 255) << 8);
|
||||
}
|
||||
|
||||
static u32 readU32(const u8* p, u16 byteOrder) {
|
||||
u32 raw = p[1] << 8 | p[0] | p[2] << 16 | p[3] << 24;
|
||||
u32 raw = p[0] | p[1] << 8;
|
||||
raw = raw | p[3] << 24 | p[2] << 16;
|
||||
if (byteOrder == 0x4949) {
|
||||
return raw;
|
||||
}
|
||||
@@ -33,9 +26,9 @@ static u32 readU32(const u8* p, u16 byteOrder) {
|
||||
|
||||
s32 TMCCJPEGDecGetOffsetEXIF(u32* pOffset, u32* pSize, TMCCJPEGDecInitParam* pParam) {
|
||||
TMCCJPEGDecWork* work;
|
||||
u16 segSize;
|
||||
u32 dataSize;
|
||||
u16 marker;
|
||||
u32 dataSize;
|
||||
u16 segSize;
|
||||
s32 result;
|
||||
u8 sig[4];
|
||||
|
||||
@@ -115,26 +108,62 @@ s32 TMCCJPEGDecGetOffsetEXIF(u32* pOffset, u32* pSize, TMCCJPEGDecInitParam* pPa
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (marker) {
|
||||
case 0xFFC0:
|
||||
case 0xFFC2:
|
||||
case 0xFFC4:
|
||||
case 0xFFDB:
|
||||
case 0xFFDC:
|
||||
case 0xFFDD:
|
||||
case 0xFFFE:
|
||||
if (marker >= 0xFFD9) {
|
||||
if (marker == 0xFFD9) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (marker == 0xFFFE) {
|
||||
result = TMCJPEGDEC_move_ptr(segSize, work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
case 0xFFDA:
|
||||
return -2;
|
||||
case 0xFFD9:
|
||||
return -2;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (marker >= 0xFFDE)
|
||||
return -0x2F;
|
||||
|
||||
if (marker >= 0xFFDB) {
|
||||
result = TMCJPEGDEC_move_ptr(segSize, work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (marker >= 0xFFC2) {
|
||||
if (marker == 0xFFC2) {
|
||||
result = TMCJPEGDEC_move_ptr(segSize, work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (marker == 0xFFC4) {
|
||||
result = TMCJPEGDEC_move_ptr(segSize, work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
return -0x2F;
|
||||
}
|
||||
|
||||
if (marker == 0xFFC0) {
|
||||
result = TMCJPEGDEC_move_ptr(segSize, work);
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
return -0x2F;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,99 +271,114 @@ _error:
|
||||
}
|
||||
|
||||
static s32 TMCJPEGDEC_exif_parse(const u8* data, u32 size, TMCCJPEGDecExifData* pInfo) {
|
||||
u16 byteOrder;
|
||||
u32 ifdOffset;
|
||||
const u8* entries;
|
||||
u16 remaining;
|
||||
u32 ifd0Offset;
|
||||
u32 ifd1Offset;
|
||||
u32 exifIfdOffset;
|
||||
u16 count;
|
||||
s32 entriesSize;
|
||||
u16 index;
|
||||
u32 entriesSize;
|
||||
u32 i;
|
||||
const u8* p;
|
||||
s32 sval;
|
||||
u16 byteOrder;
|
||||
u32 raw;
|
||||
|
||||
pInfo->thumbnailData = (u8*)data;
|
||||
pInfo->dataEnd = (u8*)data + size;
|
||||
pInfo->nextIfdOffset = 0;
|
||||
|
||||
if (size < 8) {
|
||||
return -161;
|
||||
}
|
||||
byteOrder = data[0] | data[1] << 8;
|
||||
|
||||
raw = data[0] | data[1] << 8;
|
||||
byteOrder = raw;
|
||||
if (byteOrder != 0x4D4D && byteOrder != 0x4949) {
|
||||
return -161;
|
||||
}
|
||||
if (readExifU16(data + 2, byteOrder) != 42) {
|
||||
|
||||
if (readU16(data + 2, byteOrder) != 0x002A) {
|
||||
return -161;
|
||||
}
|
||||
ifdOffset = readU32(data + 4, byteOrder);
|
||||
if (size < ifdOffset) {
|
||||
|
||||
ifd0Offset = readU32(data + 4, byteOrder);
|
||||
if (ifd0Offset > size) {
|
||||
return -161;
|
||||
}
|
||||
{
|
||||
entries = data + ifdOffset;
|
||||
remaining = size - (u16)ifdOffset;
|
||||
if (remaining < 2) {
|
||||
|
||||
sval = size - (u16)ifd0Offset;
|
||||
if (sval < 2) {
|
||||
return -161;
|
||||
}
|
||||
|
||||
p = data + (u16)ifd0Offset;
|
||||
count = readU16(p, byteOrder);
|
||||
entriesSize = count * 12;
|
||||
sval = (u32)(sval - 2);
|
||||
if (sval < entriesSize) {
|
||||
return -161;
|
||||
}
|
||||
|
||||
p += 2;
|
||||
for (i = 0; i < count; i++) {
|
||||
TMCJPEGDEC_IFD0_tag_parse(pInfo, byteOrder, p);
|
||||
p += 12;
|
||||
}
|
||||
|
||||
sval -= entriesSize;
|
||||
if (sval < 4) {
|
||||
return -161;
|
||||
}
|
||||
|
||||
ifd1Offset = readU32(p, byteOrder);
|
||||
if (ifd1Offset != 0) {
|
||||
if (ifd1Offset > size) {
|
||||
return -161;
|
||||
}
|
||||
count = readExifU16(entries, byteOrder);
|
||||
|
||||
sval = size - (u16)ifd1Offset;
|
||||
if (sval < 2) {
|
||||
return -161;
|
||||
}
|
||||
|
||||
p = data + (u16)ifd1Offset;
|
||||
count = readU16(p, byteOrder);
|
||||
entriesSize = count * 12;
|
||||
entries += 2;
|
||||
remaining -= 2;
|
||||
if (remaining < entriesSize) {
|
||||
sval = (u32)(sval - 2);
|
||||
if (sval < entriesSize) {
|
||||
return -161;
|
||||
}
|
||||
for (index = 0; index < count; index++) {
|
||||
TMCJPEGDEC_IFD0_tag_parse(pInfo, byteOrder, entries);
|
||||
entries += 12;
|
||||
|
||||
p += 2;
|
||||
for (i = 0; i < count; i++) {
|
||||
TMCJPEGDEC_IFD1_tag_parse(pInfo, byteOrder, p);
|
||||
p += 12;
|
||||
}
|
||||
remaining -= entriesSize;
|
||||
if (remaining < 4) {
|
||||
return -161;
|
||||
}
|
||||
ifdOffset = readU32(entries, byteOrder);
|
||||
}
|
||||
if (ifdOffset == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (size < ifdOffset) {
|
||||
|
||||
exifIfdOffset = pInfo->nextIfdOffset;
|
||||
if (exifIfdOffset == 0 || exifIfdOffset > size) {
|
||||
return -161;
|
||||
}
|
||||
{
|
||||
entries = data + ifdOffset;
|
||||
remaining = size - (u16)ifdOffset;
|
||||
if (remaining < 2) {
|
||||
return -161;
|
||||
}
|
||||
count = readExifU16(entries, byteOrder);
|
||||
entriesSize = count * 12;
|
||||
entries += 2;
|
||||
remaining -= 2;
|
||||
if (remaining < entriesSize) {
|
||||
return -161;
|
||||
}
|
||||
for (index = 0; index < count; index++) {
|
||||
TMCJPEGDEC_IFD1_tag_parse(pInfo, byteOrder, entries);
|
||||
entries += 12;
|
||||
}
|
||||
}
|
||||
ifdOffset = pInfo->nextIfdOffset;
|
||||
if (size < ifdOffset) {
|
||||
|
||||
sval = size - (u16)exifIfdOffset;
|
||||
if (sval < 2) {
|
||||
return -161;
|
||||
}
|
||||
{
|
||||
entries = data + ifdOffset;
|
||||
remaining = size - (u16)ifdOffset;
|
||||
if (remaining < 2) {
|
||||
return -161;
|
||||
}
|
||||
count = readExifU16(entries, byteOrder);
|
||||
entriesSize = count * 12;
|
||||
entries += 2;
|
||||
remaining -= 2;
|
||||
if (remaining < entriesSize) {
|
||||
return -161;
|
||||
}
|
||||
for (index = 0; index < count; index++) {
|
||||
TMCJPEGDEC_IFD0_tag_parse(pInfo, byteOrder, entries);
|
||||
entries += 12;
|
||||
}
|
||||
|
||||
p = data + (u16)exifIfdOffset;
|
||||
count = readU16(p, byteOrder);
|
||||
entriesSize = count * 12;
|
||||
sval = (u32)(sval - 2);
|
||||
if (sval < entriesSize) {
|
||||
return -161;
|
||||
}
|
||||
|
||||
p += 2;
|
||||
for (i = 0; i < count; i++) {
|
||||
TMCJPEGDEC_IFD0_tag_parse(pInfo, byteOrder, p);
|
||||
p += 12;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -347,10 +391,8 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
|
||||
switch (tag) {
|
||||
case 0x0103:
|
||||
case 0x0111:
|
||||
case 0x0201:
|
||||
case 0x0202: {
|
||||
break;
|
||||
case 0x0111: {
|
||||
return;
|
||||
}
|
||||
case 0x0112: {
|
||||
pInfo->orientation = readU16(entry + 8, byteOrder);
|
||||
@@ -359,18 +401,18 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
case 0x011A: {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
if (p < pInfo->thumbnailData) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p + 4 > pInfo->dataEnd) {
|
||||
return;
|
||||
}
|
||||
pInfo->xResNum = readU32(p, byteOrder);
|
||||
p = (const u8*)(pInfo->thumbnailData + offset + 4);
|
||||
if (pInfo->thumbnailData > p) {
|
||||
if (p < pInfo->thumbnailData) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p + 4 > pInfo->dataEnd) {
|
||||
return;
|
||||
}
|
||||
pInfo->xResDen = readU32(p, byteOrder);
|
||||
@@ -379,18 +421,18 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
case 0x011B: {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
if (p < pInfo->thumbnailData) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p + 4 > pInfo->dataEnd) {
|
||||
return;
|
||||
}
|
||||
pInfo->yResNum = readU32(p, byteOrder);
|
||||
p = (const u8*)(pInfo->thumbnailData + offset + 4);
|
||||
if (pInfo->thumbnailData > p) {
|
||||
if (p < pInfo->thumbnailData) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p + 4 > pInfo->dataEnd) {
|
||||
return;
|
||||
}
|
||||
pInfo->yResDen = readU32(p, byteOrder);
|
||||
@@ -402,19 +444,19 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
}
|
||||
case 0x012D: {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
u32 channel;
|
||||
u32 index;
|
||||
for (channel = 0; channel < 3; channel++) {
|
||||
for (index = 0; index < 256; index++) {
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
break;
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
u32 j;
|
||||
u32 i;
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (p < pInfo->thumbnailData) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 2) {
|
||||
break;
|
||||
if (p + 2 > pInfo->dataEnd) {
|
||||
return;
|
||||
}
|
||||
pInfo->transferFunc[channel][index] = readU16(p, byteOrder);
|
||||
offset += 2;
|
||||
pInfo->transferFunc[j][i] = readU16(p, byteOrder);
|
||||
p += 2;
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -422,18 +464,17 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
case 0x0132: {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
if (p < pInfo->thumbnailData) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 20) {
|
||||
if (p + 20 > pInfo->dataEnd) {
|
||||
return;
|
||||
}
|
||||
{
|
||||
u32 index;
|
||||
for (index = 0; index < 20; index++) {
|
||||
pInfo->dateTime[index] = p[index];
|
||||
}
|
||||
}
|
||||
*(u32*)(pInfo->dateTime + 0) = *(u32*)(p + 0);
|
||||
*(u32*)(pInfo->dateTime + 4) = *(u32*)(p + 4);
|
||||
*(u32*)(pInfo->dateTime + 8) = *(u32*)(p + 8);
|
||||
*(u32*)(pInfo->dateTime + 12) = *(u32*)(p + 12);
|
||||
*(u32*)(pInfo->dateTime + 16) = *(u32*)(p + 16);
|
||||
return;
|
||||
}
|
||||
case 0x0213: {
|
||||
@@ -470,19 +511,21 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
return;
|
||||
}
|
||||
case 0xA002: {
|
||||
if (type == 3) {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
if (type == 4) {
|
||||
pInfo->pixelXDim = offset;
|
||||
} else if (type == 3) {
|
||||
pInfo->pixelXDim = readU16(entry + 8, byteOrder);
|
||||
} else if (type == 4) {
|
||||
pInfo->pixelXDim = readU32(entry + 8, byteOrder);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case 0xA003: {
|
||||
if (type == 3) {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
if (type == 4) {
|
||||
pInfo->pixelYDim = offset;
|
||||
} else if (type == 3) {
|
||||
pInfo->pixelYDim = readU16(entry + 8, byteOrder);
|
||||
} else if (type == 4) {
|
||||
pInfo->pixelYDim = readU32(entry + 8, byteOrder);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -495,54 +538,52 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
switch (tag) {
|
||||
case 0x0132:
|
||||
case 0x0111:
|
||||
case 0x0112:
|
||||
case 0x012D:
|
||||
case 0x0213:
|
||||
case 0x8769:
|
||||
case 0x9000:
|
||||
case 0x9101:
|
||||
case 0xA003: {
|
||||
break;
|
||||
case 0x9101: {
|
||||
return;
|
||||
}
|
||||
case 0x0103: {
|
||||
pInfo->compressionIfd1 = readU16(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x011A: {
|
||||
u32 offset;
|
||||
const u8* p;
|
||||
offset = readU32(entry + 8, byteOrder);
|
||||
p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
if (p < pInfo->thumbnailData) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p + 4 > pInfo->dataEnd) {
|
||||
return;
|
||||
}
|
||||
pInfo->xResNumIfd1 = readU32(p, byteOrder);
|
||||
p = (const u8*)(pInfo->thumbnailData + offset + 4);
|
||||
if (pInfo->thumbnailData > p) {
|
||||
if (p < pInfo->thumbnailData) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p + 4 > pInfo->dataEnd) {
|
||||
return;
|
||||
}
|
||||
pInfo->xResDenIfd1 = readU32(p, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x011B: {
|
||||
u32 offset;
|
||||
const u8* p;
|
||||
offset = readU32(entry + 8, byteOrder);
|
||||
p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
u32 offset = readU32(entry + 8, byteOrder);
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
if (p < pInfo->thumbnailData) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p + 4 > pInfo->dataEnd) {
|
||||
return;
|
||||
}
|
||||
pInfo->planarConfigIfd1 = readU32(p, byteOrder);
|
||||
p = (const u8*)(pInfo->thumbnailData + offset + 4);
|
||||
if (pInfo->thumbnailData > p) {
|
||||
if (p < pInfo->thumbnailData) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - 4) {
|
||||
if (p + 4 > pInfo->dataEnd) {
|
||||
return;
|
||||
}
|
||||
pInfo->yResDenIfd1 = readU32(p, byteOrder);
|
||||
@@ -552,10 +593,6 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
pInfo->resUnitIfd1 = readU16(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x0103: {
|
||||
pInfo->compressionIfd1 = readU16(entry + 8, byteOrder);
|
||||
return;
|
||||
}
|
||||
case 0x0201: {
|
||||
pInfo->thumbnailOffset = readU32(entry + 8, byteOrder);
|
||||
return;
|
||||
|
||||
@@ -1411,22 +1411,131 @@ static s32 TMCJPEGDEC_parse_dht(s32 first, TMCCJPEGDecWork* work) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __MWERKS__
|
||||
static asm s32 TMCJPEGDEC_parse_dqt(register TMCCJPEGDecWork* work) {
|
||||
nofralloc
|
||||
|
||||
stwu r1, -0x130(r1)
|
||||
mflr r0
|
||||
lis r4, lbl_8161E080@ha
|
||||
stw r0, 0x134(r1)
|
||||
addi r4, r4, lbl_8161E080@l
|
||||
li r0, 0x20
|
||||
addi r6, r1, 0xc
|
||||
stmw r24, 0x110(r1)
|
||||
mr r30, r3
|
||||
addi r5, r4, -4
|
||||
mtctr r0
|
||||
|
||||
_parse_dqt_copy:
|
||||
lwz r4, 4(r5)
|
||||
lwzu r0, 8(r5)
|
||||
stw r4, 4(r6)
|
||||
stwu r0, 8(r6)
|
||||
bdnz _parse_dqt_copy
|
||||
|
||||
addi r31, r3, 0x58
|
||||
mr r4, r30
|
||||
addi r3, r1, 0xa
|
||||
bl TMCJPEGDEC_get_wbyte
|
||||
cmpwi r3, 0
|
||||
bge _parse_dqt_have_length
|
||||
b _parse_dqt_return
|
||||
|
||||
_parse_dqt_have_length:
|
||||
lhz r3, 0xa(r1)
|
||||
addi r29, r1, 0x10
|
||||
li r27, 1
|
||||
lis r28, TMCJPEGDEC_Zigzag_data@ha
|
||||
addi r0, r3, -2
|
||||
sth r0, 0xa(r1)
|
||||
|
||||
_parse_dqt_table:
|
||||
lhz r5, 0xa(r1)
|
||||
mr r4, r30
|
||||
addi r3, r1, 9
|
||||
addi r0, r5, -0x41
|
||||
sth r0, 0xa(r1)
|
||||
bl TMCJPEGDEC_get_byte
|
||||
cmpwi r3, 0
|
||||
bge _parse_dqt_have_qt_info
|
||||
b _parse_dqt_return
|
||||
|
||||
_parse_dqt_have_qt_info:
|
||||
lbz r0, 9(r1)
|
||||
cmplwi r0, 4
|
||||
ble _parse_dqt_valid_qt_info
|
||||
li r3, -0x41
|
||||
b _parse_dqt_return
|
||||
|
||||
_parse_dqt_valid_qt_info:
|
||||
add r3, r31, r0
|
||||
addi r26, r28, TMCJPEGDEC_Zigzag_data@l
|
||||
stb r27, 0x1790(r3)
|
||||
li r25, 0
|
||||
|
||||
_parse_dqt_coeff:
|
||||
lbz r24, 0(r26)
|
||||
cmpwi r24, 0x3f
|
||||
ble _parse_dqt_valid_coeff
|
||||
li r3, -0x41
|
||||
b _parse_dqt_return
|
||||
|
||||
_parse_dqt_valid_coeff:
|
||||
mr r4, r30
|
||||
addi r3, r1, 8
|
||||
bl TMCJPEGDEC_get_byte
|
||||
cmpwi r3, 0
|
||||
bge _parse_dqt_have_coeff
|
||||
b _parse_dqt_return
|
||||
|
||||
_parse_dqt_have_coeff:
|
||||
slwi r4, r24, 2
|
||||
lbz r3, 9(r1)
|
||||
add r0, r4, r31
|
||||
lbz r5, 8(r1)
|
||||
lwzx r4, r29, r4
|
||||
slwi r3, r3, 8
|
||||
mullw. r4, r5, r4
|
||||
stwx r4, r3, r0
|
||||
bne _parse_dqt_nonzero
|
||||
li r3, -0x41
|
||||
b _parse_dqt_return
|
||||
|
||||
_parse_dqt_nonzero:
|
||||
addi r25, r25, 1
|
||||
addi r26, r26, 1
|
||||
cmpwi r25, 0x40
|
||||
blt _parse_dqt_coeff
|
||||
lhz r0, 0xa(r1)
|
||||
cmpwi r0, 0
|
||||
bne _parse_dqt_table
|
||||
li r3, 0
|
||||
|
||||
_parse_dqt_return:
|
||||
lmw r24, 0x110(r1)
|
||||
lwz r0, 0x134(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x130
|
||||
blr
|
||||
}
|
||||
#else
|
||||
static s32 TMCJPEGDEC_parse_dqt(TMCCJPEGDecWork* work) {
|
||||
typedef struct {
|
||||
u32 data[64];
|
||||
} CopyBlock64;
|
||||
|
||||
typedef struct { u32 coefficients[4][64]; } QuantizationTables;
|
||||
QuantizationTables* scaleInfo;
|
||||
u32 tblCopy[64];
|
||||
u8* scaleInfo;
|
||||
u32 tblCopy[65];
|
||||
u32* tblPtr;
|
||||
u32* d;
|
||||
u16 len;
|
||||
s32 r;
|
||||
|
||||
d = tblCopy;
|
||||
*(CopyBlock64*)d = *(CopyBlock64*)lbl_8161E080;
|
||||
*(CopyBlock64*)(d + 1) = *(CopyBlock64*)lbl_8161E080;
|
||||
|
||||
scaleInfo = (QuantizationTables*)&work->scaleFlag;
|
||||
scaleInfo = (u8*)work + 0x58;
|
||||
|
||||
r = TMCJPEGDEC_get_wbyte(&len, work);
|
||||
if (r < 0) {
|
||||
@@ -1434,6 +1543,8 @@ static s32 TMCJPEGDEC_parse_dqt(TMCCJPEGDecWork* work) {
|
||||
}
|
||||
len -= 2;
|
||||
|
||||
tblPtr = &tblCopy[1];
|
||||
|
||||
do {
|
||||
u8 qtInfo;
|
||||
const u8* zigPtr;
|
||||
@@ -1452,10 +1563,11 @@ static s32 TMCJPEGDEC_parse_dqt(TMCCJPEGDecWork* work) {
|
||||
return -0x41;
|
||||
}
|
||||
|
||||
((TMCUnknownInfo*)scaleInfo)->quantTblFlag[qtInfo] = 1;
|
||||
scaleInfo[qtInfo + 0x1790] = 1; // quantTblFlag[0..3]
|
||||
|
||||
zigPtr = TMCJPEGDEC_Zigzag_data;
|
||||
for (zzIdx = 0; zzIdx < 64; zzIdx++) {
|
||||
u32 tmp;
|
||||
|
||||
zz = *zigPtr;
|
||||
if (zz > 0x3F) {
|
||||
@@ -1467,8 +1579,9 @@ static s32 TMCJPEGDEC_parse_dqt(TMCCJPEGDecWork* work) {
|
||||
return r;
|
||||
}
|
||||
|
||||
val = (u32)byte * tblCopy[zz];
|
||||
scaleInfo->coefficients[qtInfo][zz] = val;
|
||||
tmp = (zz << 2) + ((u32)qtInfo << 8);
|
||||
val = (u32)byte * tblPtr[zz];
|
||||
*(u32*)(tmp + scaleInfo) = val;
|
||||
if (val == 0) {
|
||||
return -0x41;
|
||||
}
|
||||
@@ -1479,6 +1592,7 @@ static s32 TMCJPEGDEC_parse_dqt(TMCCJPEGDecWork* work) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __MWERKS__
|
||||
static asm s32 TMCJPEGDEC_parse_sof(register TMCCJPEGDecWork* work) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,874 +1,5 @@
|
||||
#define TMC_JPEG_PLANAR_OUTPUT
|
||||
#include <tmc_jpeg_internal.h>
|
||||
|
||||
static void TMCJPEG_814EFEAC(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F043C(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F0A58(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F11C4(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F17E0(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F1F48(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F2570(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F2B50(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F3158(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F32E4(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F34A4(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F372C(TMCCJPEGDecWork*, s32, s32);
|
||||
|
||||
s32 TMCJPEGDEC_set_converterY8U8V8(TMCCJPEGDecWork* work) {
|
||||
u8* buffer;
|
||||
s32 componentCount;
|
||||
TMCCJPEGDecState* state;
|
||||
|
||||
buffer = work->convBuf;
|
||||
componentCount = work->componentCount;
|
||||
state = work->pState;
|
||||
|
||||
switch (componentCount) {
|
||||
case 0: {
|
||||
u8 mode;
|
||||
u8* firstRow;
|
||||
u8* secondRow;
|
||||
u8* thirdRow;
|
||||
u8* fourthRow;
|
||||
u8* cbBlock;
|
||||
u8* crBlock;
|
||||
|
||||
mode = work->idctMode;
|
||||
firstRow = buffer + 4;
|
||||
work->pConverterFunc = TMCJPEG_814EFEAC;
|
||||
work->pConverterFuncEdge = TMCJPEG_814F043C;
|
||||
secondRow = firstRow + mode;
|
||||
thirdRow = secondRow + mode;
|
||||
fourthRow = thirdRow + mode;
|
||||
cbBlock = buffer + 260;
|
||||
crBlock = buffer + 324;
|
||||
work->pConvRowPtrs[0] = firstRow;
|
||||
work->pConvRowPtrs[1] = secondRow;
|
||||
work->pConvRowPtrs[2] = thirdRow;
|
||||
work->pConvRowPtrs[3] = fourthRow;
|
||||
work->pConvRowPtrs[5] = cbBlock;
|
||||
work->pConvRowPtrs[6] = crBlock;
|
||||
work->pitch = 32;
|
||||
work->converterFlags = 0;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
u8 mode;
|
||||
u8* firstRow;
|
||||
u8* secondRow;
|
||||
u8* cbBlock;
|
||||
u8* crBlock;
|
||||
|
||||
mode = work->idctMode;
|
||||
firstRow = buffer + 4;
|
||||
work->pConverterFunc = TMCJPEG_814F0A58;
|
||||
work->pConverterFuncEdge = TMCJPEG_814F11C4;
|
||||
secondRow = firstRow + mode;
|
||||
cbBlock = buffer + 132;
|
||||
crBlock = buffer + 196;
|
||||
work->pConvRowPtrs[0] = firstRow;
|
||||
work->pConvRowPtrs[1] = secondRow;
|
||||
work->pConvRowPtrs[5] = cbBlock;
|
||||
work->pConvRowPtrs[6] = crBlock;
|
||||
work->pitch = 16;
|
||||
work->converterFlags = 0;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
u8 mode;
|
||||
u8* firstRow;
|
||||
u8* secondRow;
|
||||
u8* thirdRow;
|
||||
u8* fourthRow;
|
||||
u8* cbBlock;
|
||||
u8* crBlock;
|
||||
|
||||
mode = work->idctMode;
|
||||
firstRow = buffer + 4;
|
||||
work->pConverterFunc = TMCJPEG_814F17E0;
|
||||
work->pConverterFuncEdge = TMCJPEG_814F1F48;
|
||||
secondRow = firstRow + mode;
|
||||
thirdRow = firstRow + mode * 16;
|
||||
fourthRow = thirdRow + mode;
|
||||
cbBlock = buffer + 260;
|
||||
crBlock = buffer + 324;
|
||||
work->pConvRowPtrs[0] = firstRow;
|
||||
work->pConvRowPtrs[1] = secondRow;
|
||||
work->pConvRowPtrs[2] = thirdRow;
|
||||
work->pConvRowPtrs[3] = fourthRow;
|
||||
work->pConvRowPtrs[5] = cbBlock;
|
||||
work->pConvRowPtrs[6] = crBlock;
|
||||
work->pitch = 16;
|
||||
work->converterFlags = 0;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
u8 mode;
|
||||
u8* firstRow;
|
||||
u8* secondRow;
|
||||
u8* cbBlock;
|
||||
u8* crBlock;
|
||||
|
||||
mode = work->idctMode;
|
||||
firstRow = buffer + 4;
|
||||
work->pConverterFunc = TMCJPEG_814F2570;
|
||||
work->pConverterFuncEdge = TMCJPEG_814F2B50;
|
||||
secondRow = firstRow + mode * 8;
|
||||
cbBlock = buffer + 132;
|
||||
crBlock = buffer + 196;
|
||||
work->pConvRowPtrs[0] = firstRow;
|
||||
work->pConvRowPtrs[1] = secondRow;
|
||||
work->pConvRowPtrs[5] = cbBlock;
|
||||
work->pConvRowPtrs[6] = crBlock;
|
||||
work->pitch = 8;
|
||||
work->converterFlags = 0;
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
TMCConverterFunc* converter;
|
||||
TMCConverterFunc* edgeConverter;
|
||||
converter = TMCJPEG_814F3158;
|
||||
edgeConverter = TMCJPEG_814F32E4;
|
||||
work->pConvRowPtrs[0] = buffer + 4;
|
||||
work->pConvRowPtrs[5] = buffer + 0x44;
|
||||
work->pConvRowPtrs[6] = buffer + 0x84;
|
||||
work->pConverterFunc = converter;
|
||||
work->pConverterFuncEdge = edgeConverter;
|
||||
work->pitch = 0x08;
|
||||
work->converterFlags = 0;
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
TMCConverterFunc* converter;
|
||||
TMCConverterFunc* edgeConverter;
|
||||
converter = TMCJPEG_814F34A4;
|
||||
edgeConverter = TMCJPEG_814F372C;
|
||||
work->pConvRowPtrs[0] = buffer + 4;
|
||||
work->pConverterFunc = converter;
|
||||
work->pConverterFuncEdge = edgeConverter;
|
||||
work->pitch = 0x08;
|
||||
work->converterFlags = 0;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return TMCC_ERROR_FORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
s32 width = state->jpegWidth;
|
||||
s32 height = state->jpegHeight;
|
||||
state->convWidth = ((u32)width / 8 + (width % 8 != 0)) * 8;
|
||||
state->convHeight = ((u32)height / 4 + (height % 4 != 0)) * 4;
|
||||
width = state->outputWidth;
|
||||
height = state->outputHeight;
|
||||
state->chromaWidth = ((u32)width / 8 + (width % 8 != 0)) * 8;
|
||||
state->chromaHeight = ((u32)height / 4 + (height % 4 != 0)) * 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void TMCJPEG_814EFEAC(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
s32 rowSkip;
|
||||
u8* output;
|
||||
s32 chromaXEnd;
|
||||
u32 tileRow;
|
||||
u32 chromaTileWidth;
|
||||
s32 chromaYEnd;
|
||||
u8* lumaTexture;
|
||||
TMCCJPEGDecState* state;
|
||||
u8* luminance;
|
||||
s32 column;
|
||||
s32 row;
|
||||
u8* cbTexture;
|
||||
s32 xEnd;
|
||||
s32 height;
|
||||
u8* crTexture;
|
||||
s32 yEnd;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
u32 tileWidth;
|
||||
s32 width;
|
||||
|
||||
row = y;
|
||||
luminance = work->convBuf + 4;
|
||||
cb = &work->convBuf[260];
|
||||
cr = &work->convBuf[324];
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
cbTexture = state->pCbBuffer;
|
||||
crTexture = state->pCrBuffer;
|
||||
width = 32 / state->scaleFactor;
|
||||
height = 8 / state->scaleFactor;
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
rowSkip = 32 - width;
|
||||
for (; row < yEnd; row++) {
|
||||
output = lumaTexture + ((row & 3) << 3);
|
||||
tileRow = (row >> 2) * tileWidth;
|
||||
for (column = x; column < xEnd; column += 4) {
|
||||
(output + (column & 7))[(s32)(((column >> 3) + tileRow) << 5)] = luminance[0];
|
||||
(output + ((column + 1) & 7))[(s32)((((column + 1) >> 3) + tileRow) << 5)] = luminance[1];
|
||||
(output + ((column + 2) & 7))[(s32)((((column + 2) >> 3) + tileRow) << 5)] = luminance[2];
|
||||
(output + ((column + 3) & 7))[(s32)((((column + 3) >> 3) + tileRow) << 5)] = luminance[3];
|
||||
luminance += 4;
|
||||
}
|
||||
luminance += rowSkip;
|
||||
}
|
||||
chromaTileWidth = state->chromaWidth >> 3;
|
||||
x = (u32)x >> 2;
|
||||
width = 8 / state->scaleFactor;
|
||||
height = 8 / state->scaleFactor;
|
||||
chromaXEnd = x + width;
|
||||
chromaYEnd = y + height;
|
||||
for (; y < chromaYEnd; y++) {
|
||||
for (column = x; column < chromaXEnd; column += 1) {
|
||||
(cbTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cb + 128;
|
||||
cb++;
|
||||
(crTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cr + 128;
|
||||
cr++;
|
||||
}
|
||||
cb += 8 - width;
|
||||
cr += 8 - width;
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F043C(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
u32 chromaTileWidth;
|
||||
TMCCJPEGDecState* state;
|
||||
u8* lumaTexture;
|
||||
u8* luminance;
|
||||
s32 column;
|
||||
s32 row;
|
||||
s32 chromaEnd;
|
||||
u8* cbTexture;
|
||||
u8* crTexture;
|
||||
u32 tileRow;
|
||||
s32 height;
|
||||
s32 yEnd;
|
||||
u8* output;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
s32 xEnd;
|
||||
s32 tileOffset;
|
||||
s32 width;
|
||||
u32 tileWidth;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
cb = &work->convBuf[260];
|
||||
cr = &work->convBuf[324];
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
cbTexture = state->pCbBuffer;
|
||||
crTexture = state->pCrBuffer;
|
||||
if (state->dataSizeX == (u32)x) {
|
||||
width = state->stepXExt;
|
||||
} else {
|
||||
width = 32 / state->scaleFactor;
|
||||
}
|
||||
if (state->dataSizeY == (u32)y) {
|
||||
height = state->stepYExt;
|
||||
} else {
|
||||
height = 8 / state->scaleFactor;
|
||||
}
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (row = y; row < yEnd; row++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
tileRow = (row >> 2) * tileWidth;
|
||||
tileOffset = ((column >> 3) + tileRow) << 5;
|
||||
output = lumaTexture + ((row & 3) << 3) + (column & 7);
|
||||
output[tileOffset] = *luminance++;
|
||||
}
|
||||
luminance += 32 - width;
|
||||
}
|
||||
x = (u32)x >> 2;
|
||||
width = (width + 3) >> 2;
|
||||
xEnd = x + width;
|
||||
chromaTileWidth = state->chromaWidth >> 3;
|
||||
chromaEnd = y + height;
|
||||
for (; y < chromaEnd; y++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
(cbTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cb + 128;
|
||||
cb++;
|
||||
(crTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cr + 128;
|
||||
cr++;
|
||||
}
|
||||
cb += 8 - width;
|
||||
cr += 8 - width;
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F0A58(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
s32 chromaYEnd;
|
||||
u8* lumaTexture;
|
||||
u8* luminance;
|
||||
s32 column;
|
||||
s32 chromaXEnd;
|
||||
s32 row;
|
||||
u32 chromaTileWidth;
|
||||
TMCCJPEGDecState* state;
|
||||
s32 width;
|
||||
s32 height;
|
||||
u8* cbTexture;
|
||||
s32 xEnd;
|
||||
u8* crTexture;
|
||||
s32 yEnd;
|
||||
u8* cb;
|
||||
u32 tileWidth;
|
||||
u8* cr;
|
||||
s32 chromaRowSkip;
|
||||
|
||||
row = y;
|
||||
luminance = work->convBuf + 4;
|
||||
cb = &work->convBuf[132];
|
||||
cr = &work->convBuf[196];
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
cbTexture = state->pCbBuffer;
|
||||
crTexture = state->pCrBuffer;
|
||||
width = 16 / state->scaleFactor;
|
||||
height = 8 / state->scaleFactor;
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (; row < yEnd; row++) {
|
||||
for (column = x; column < xEnd; column += 2) {
|
||||
(lumaTexture + ((row & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (row >> 2) * tileWidth) << 5)] = *luminance++;
|
||||
(lumaTexture + ((row & 3) << 3) + ((column + 1) & 7))[(s32)((((column + 1) >> 3) + (row >> 2) * tileWidth) << 5)] = *luminance++;
|
||||
}
|
||||
luminance += 16 - width;
|
||||
}
|
||||
x = (u32)x >> 1;
|
||||
width = 8 / state->scaleFactor;
|
||||
height = 8 / state->scaleFactor;
|
||||
chromaXEnd = x + width;
|
||||
chromaYEnd = y + height;
|
||||
chromaTileWidth = state->chromaWidth >> 3;
|
||||
chromaRowSkip = 8 - width;
|
||||
for (; y < chromaYEnd; y++) {
|
||||
for (column = x; column < chromaXEnd; column += 1) {
|
||||
(cbTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cb + 128;
|
||||
cb++;
|
||||
(crTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cr + 128;
|
||||
cr++;
|
||||
}
|
||||
cb += chromaRowSkip;
|
||||
cr += 8 - width;
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F11C4(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
u32 chromaTileWidth;
|
||||
TMCCJPEGDecState* state;
|
||||
u8* lumaTexture;
|
||||
u8* luminance;
|
||||
s32 column;
|
||||
s32 row;
|
||||
s32 chromaEnd;
|
||||
u8* cbTexture;
|
||||
u8* crTexture;
|
||||
u32 tileRow;
|
||||
s32 height;
|
||||
s32 yEnd;
|
||||
u8* output;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
s32 xEnd;
|
||||
s32 tileOffset;
|
||||
s32 width;
|
||||
u32 tileWidth;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
cb = &work->convBuf[132];
|
||||
cr = &work->convBuf[196];
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
cbTexture = state->pCbBuffer;
|
||||
crTexture = state->pCrBuffer;
|
||||
if (state->dataSizeX == (u32)x) {
|
||||
width = state->stepXExt;
|
||||
} else {
|
||||
width = 16 / state->scaleFactor;
|
||||
}
|
||||
if (state->dataSizeY == (u32)y) {
|
||||
height = state->stepYExt;
|
||||
} else {
|
||||
height = 8 / state->scaleFactor;
|
||||
}
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (row = y; row < yEnd; row++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
tileRow = (row >> 2) * tileWidth;
|
||||
tileOffset = ((column >> 3) + tileRow) << 5;
|
||||
output = lumaTexture + ((row & 3) << 3) + (column & 7);
|
||||
output[tileOffset] = *luminance++;
|
||||
}
|
||||
luminance += 16 - width;
|
||||
}
|
||||
x = (u32)x >> 1;
|
||||
width = (width + 1) >> 1;
|
||||
xEnd = x + width;
|
||||
chromaTileWidth = state->chromaWidth >> 3;
|
||||
chromaEnd = y + height;
|
||||
for (; y < chromaEnd; y++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
(cbTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cb + 128;
|
||||
cb++;
|
||||
(crTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cr + 128;
|
||||
cr++;
|
||||
}
|
||||
cb += 8 - width;
|
||||
cr += 8 - width;
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F17E0(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
s32 height;
|
||||
s32 chromaYEnd;
|
||||
s32 column;
|
||||
u8* lumaTexture;
|
||||
s32 chromaXEnd;
|
||||
u8* luminance;
|
||||
u32 chromaTileWidth;
|
||||
u8* cbTexture;
|
||||
s32 width;
|
||||
u8* crTexture;
|
||||
u32 tileWidth;
|
||||
u8* cb;
|
||||
TMCCJPEGDecState* state;
|
||||
s32 yEnd;
|
||||
s32 xEnd;
|
||||
u8* cr;
|
||||
s32 row;
|
||||
|
||||
row = y;
|
||||
luminance = work->convBuf + 4;
|
||||
cb = &work->convBuf[260];
|
||||
cr = &work->convBuf[324];
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
cbTexture = state->pCbBuffer;
|
||||
crTexture = state->pCrBuffer;
|
||||
width = 16 / state->scaleFactor;
|
||||
height = 16 / state->scaleFactor;
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (; row < yEnd; row++) {
|
||||
for (column = x; column < xEnd; column += 2) {
|
||||
(lumaTexture + ((row & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (row >> 2) * tileWidth) << 5)] = *luminance++;
|
||||
(lumaTexture + ((row & 3) << 3) + ((column + 1) & 7))[(s32)((((column + 1) >> 3) + (row >> 2) * tileWidth) << 5)] = *luminance++;
|
||||
}
|
||||
luminance += 16 - width;
|
||||
}
|
||||
x = (u32)x >> 1;
|
||||
y = (u32)y >> 1;
|
||||
width = 8 / state->scaleFactor;
|
||||
height = 8 / state->scaleFactor;
|
||||
chromaXEnd = x + width;
|
||||
chromaYEnd = y + height;
|
||||
chromaTileWidth = state->chromaWidth >> 3;
|
||||
for (; y < chromaYEnd; y++) {
|
||||
for (column = x; column < chromaXEnd; column += 1) {
|
||||
(cbTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cb + 128;
|
||||
cb++;
|
||||
(crTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cr + 128;
|
||||
cr++;
|
||||
}
|
||||
cb += 8 - width;
|
||||
cr += 8 - width;
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F1F48(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
u32 chromaTileWidth;
|
||||
TMCCJPEGDecState* state;
|
||||
u8* lumaTexture;
|
||||
u8* luminance;
|
||||
s32 column;
|
||||
s32 row;
|
||||
s32 chromaEnd;
|
||||
u8* cbTexture;
|
||||
u8* crTexture;
|
||||
u32 tileRow;
|
||||
s32 height;
|
||||
s32 yEnd;
|
||||
u8* output;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
s32 xEnd;
|
||||
s32 tileOffset;
|
||||
s32 width;
|
||||
u32 tileWidth;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
cb = &work->convBuf[260];
|
||||
cr = &work->convBuf[324];
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
cbTexture = state->pCbBuffer;
|
||||
crTexture = state->pCrBuffer;
|
||||
if (state->dataSizeX == (u32)x) {
|
||||
width = state->stepXExt;
|
||||
} else {
|
||||
width = 16 / state->scaleFactor;
|
||||
}
|
||||
if (state->dataSizeY == (u32)y) {
|
||||
height = state->stepYExt;
|
||||
} else {
|
||||
height = 16 / state->scaleFactor;
|
||||
}
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (row = y; row < yEnd; row++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
tileRow = (row >> 2) * tileWidth;
|
||||
tileOffset = ((column >> 3) + tileRow) << 5;
|
||||
output = lumaTexture + ((row & 3) << 3) + (column & 7);
|
||||
output[tileOffset] = *luminance++;
|
||||
}
|
||||
luminance += 16 - width;
|
||||
}
|
||||
y = (u32)y >> 1;
|
||||
x = (u32)x >> 1;
|
||||
width = (width + 1) >> 1;
|
||||
xEnd = x + width;
|
||||
chromaTileWidth = state->chromaWidth >> 3;
|
||||
chromaEnd = y + ((height + 1) >> 1);
|
||||
for (; y < chromaEnd; y++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
(cbTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cb + 128;
|
||||
cb++;
|
||||
(crTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cr + 128;
|
||||
cr++;
|
||||
}
|
||||
cb += 8 - width;
|
||||
cr += 8 - width;
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F2570(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
u32 chromaTileWidth;
|
||||
TMCCJPEGDecState* state;
|
||||
u8* lumaTexture;
|
||||
u8* luminance;
|
||||
s32 column;
|
||||
s32 row;
|
||||
s32 chromaEnd;
|
||||
u8* cbTexture;
|
||||
u8* crTexture;
|
||||
u32 tileRow;
|
||||
s32 height;
|
||||
s32 yEnd;
|
||||
u8* output;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
s32 xEnd;
|
||||
s32 tileOffset;
|
||||
s32 width;
|
||||
u32 tileWidth;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
cb = &work->convBuf[132];
|
||||
cr = &work->convBuf[196];
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
cbTexture = state->pCbBuffer;
|
||||
crTexture = state->pCrBuffer;
|
||||
width = 8 / state->scaleFactor;
|
||||
height = 16 / state->scaleFactor;
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (row = y; row < yEnd; row++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
tileRow = (row >> 2) * tileWidth;
|
||||
tileOffset = ((column >> 3) + tileRow) << 5;
|
||||
output = lumaTexture + ((row & 3) << 3) + (column & 7);
|
||||
output[tileOffset] = *luminance++;
|
||||
}
|
||||
luminance += 8 - width;
|
||||
}
|
||||
y = (u32)y >> 1;
|
||||
chromaTileWidth = state->chromaWidth >> 3;
|
||||
chromaEnd = y + 8 / state->scaleFactor;
|
||||
for (; y < chromaEnd; y++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
(cbTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cb + 128;
|
||||
cb++;
|
||||
(crTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cr + 128;
|
||||
cr++;
|
||||
}
|
||||
cb += 8 - width;
|
||||
cr += 8 - width;
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F2B50(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
u32 chromaTileWidth;
|
||||
TMCCJPEGDecState* state;
|
||||
u8* lumaTexture;
|
||||
u8* luminance;
|
||||
s32 column;
|
||||
s32 row;
|
||||
s32 chromaEnd;
|
||||
u8* cbTexture;
|
||||
u8* crTexture;
|
||||
u32 tileRow;
|
||||
s32 height;
|
||||
s32 yEnd;
|
||||
u8* output;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
s32 xEnd;
|
||||
s32 tileOffset;
|
||||
s32 width;
|
||||
u32 tileWidth;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
cb = &work->convBuf[132];
|
||||
cr = &work->convBuf[196];
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
cbTexture = state->pCbBuffer;
|
||||
crTexture = state->pCrBuffer;
|
||||
if (state->dataSizeX == (u32)x) {
|
||||
width = state->stepXExt;
|
||||
} else {
|
||||
width = 8 / state->scaleFactor;
|
||||
}
|
||||
if (state->dataSizeY == (u32)y) {
|
||||
height = state->stepYExt;
|
||||
} else {
|
||||
height = 16 / state->scaleFactor;
|
||||
}
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (row = y; row < yEnd; row++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
tileRow = (row >> 2) * tileWidth;
|
||||
tileOffset = ((column >> 3) + tileRow) << 5;
|
||||
output = lumaTexture + ((row & 3) << 3) + (column & 7);
|
||||
output[tileOffset] = *luminance++;
|
||||
}
|
||||
luminance += 8 - width;
|
||||
}
|
||||
y = (u32)y >> 1;
|
||||
chromaTileWidth = state->chromaWidth >> 3;
|
||||
chromaEnd = y + ((height + 1) >> 1);
|
||||
for (; y < chromaEnd; y++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
(cbTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cb + 128;
|
||||
cb++;
|
||||
(crTexture + ((y & 3) << 3) + (column & 7))[(s32)(((column >> 3) + (y >> 2) * chromaTileWidth) << 5)] = *cr + 128;
|
||||
cr++;
|
||||
}
|
||||
cb += 8 - width;
|
||||
cr += 8 - width;
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F3158(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
s32 rowSkip;
|
||||
u8* output;
|
||||
s32 height;
|
||||
s32 tileRow;
|
||||
u8* cbOutput;
|
||||
TMCCJPEGDecState* state;
|
||||
u8* crOutput;
|
||||
s32 pixelOffset;
|
||||
s32 tileOffset;
|
||||
u8* lumaTexture;
|
||||
s32 width;
|
||||
u32 rowOffset;
|
||||
u8* cbTexture;
|
||||
u8* crTexture;
|
||||
u8* luminance;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
s32 column;
|
||||
s32 xEnd;
|
||||
s32 yEnd;
|
||||
u32 tileWidth;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
cb = &work->convBuf[68];
|
||||
cr = &work->convBuf[132];
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
cbTexture = state->pCbBuffer;
|
||||
crTexture = state->pCrBuffer;
|
||||
width = 8 / state->scaleFactor;
|
||||
height = 8 / state->scaleFactor;
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
rowSkip = 8 - width;
|
||||
for (; y < yEnd; y++) {
|
||||
tileRow = (y >> 2) * tileWidth;
|
||||
rowOffset = (y & 3) << 3;
|
||||
output = lumaTexture + rowOffset;
|
||||
cbOutput = cbTexture + rowOffset;
|
||||
crOutput = crTexture + rowOffset;
|
||||
for (column = x; column < xEnd;) {
|
||||
tileOffset = ((column >> 3) + tileRow) << 5;
|
||||
pixelOffset = column++ & 7;
|
||||
(output + pixelOffset)[tileOffset] = *luminance++;
|
||||
(cbOutput + pixelOffset)[tileOffset] = *cb++ + 128;
|
||||
(crOutput + pixelOffset)[tileOffset] = *cr++ + 128;
|
||||
}
|
||||
luminance += rowSkip;
|
||||
cb += rowSkip;
|
||||
cr += rowSkip;
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F32E4(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
s32 rowSkip;
|
||||
u8* output;
|
||||
s32 height;
|
||||
s32 tileRow;
|
||||
u8* cbOutput;
|
||||
TMCCJPEGDecState* state;
|
||||
u8* crOutput;
|
||||
s32 pixelOffset;
|
||||
s32 tileOffset;
|
||||
u8* lumaTexture;
|
||||
s32 width;
|
||||
u32 rowOffset;
|
||||
u8* cbTexture;
|
||||
u8* crTexture;
|
||||
u8* luminance;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
s32 column;
|
||||
s32 xEnd;
|
||||
s32 yEnd;
|
||||
u32 tileWidth;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
cb = &work->convBuf[68];
|
||||
cr = &work->convBuf[132];
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
cbTexture = state->pCbBuffer;
|
||||
crTexture = state->pCrBuffer;
|
||||
if (state->dataSizeX == (u32)x) {
|
||||
width = state->stepXExt;
|
||||
} else {
|
||||
width = 8 / state->scaleFactor;
|
||||
}
|
||||
if (state->dataSizeY == (u32)y) {
|
||||
height = state->stepYExt;
|
||||
} else {
|
||||
height = 8 / state->scaleFactor;
|
||||
}
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
rowSkip = 8 - width;
|
||||
for (; y < yEnd; y++) {
|
||||
tileRow = (y >> 2) * tileWidth;
|
||||
rowOffset = (y & 3) << 3;
|
||||
output = lumaTexture + rowOffset;
|
||||
cbOutput = cbTexture + rowOffset;
|
||||
crOutput = crTexture + rowOffset;
|
||||
for (column = x; column < xEnd;) {
|
||||
tileOffset = ((column >> 3) + tileRow) << 5;
|
||||
pixelOffset = column++ & 7;
|
||||
(output + pixelOffset)[tileOffset] = *luminance++;
|
||||
(cbOutput + pixelOffset)[tileOffset] = *cb++ + 128;
|
||||
(crOutput + pixelOffset)[tileOffset] = *cr++ + 128;
|
||||
}
|
||||
luminance += rowSkip;
|
||||
cb += rowSkip;
|
||||
cr += rowSkip;
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F34A4(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
s32 height;
|
||||
u8* lumaTexture;
|
||||
u8* luminance;
|
||||
s32 column;
|
||||
s32 xEnd;
|
||||
s32 yEnd;
|
||||
u8* output;
|
||||
s32 width;
|
||||
TMCCJPEGDecState* state;
|
||||
u32 tileRow;
|
||||
u32 tileWidth;
|
||||
s32 tileOffset;
|
||||
s32 row;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
width = 8 / state->scaleFactor;
|
||||
height = 8 / state->scaleFactor;
|
||||
{
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (row = y; row < yEnd; row++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
tileRow = (row >> 2) * tileWidth;
|
||||
tileOffset = ((column >> 3) + tileRow) << 5;
|
||||
output = lumaTexture + ((row & 3) << 3) + (column & 7);
|
||||
output[tileOffset] = *luminance++;
|
||||
}
|
||||
luminance += 8 - width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void TMCJPEG_814F372C(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
s32 height;
|
||||
u8* lumaTexture;
|
||||
u8* luminance;
|
||||
s32 column;
|
||||
s32 xEnd;
|
||||
s32 yEnd;
|
||||
u8* output;
|
||||
s32 width;
|
||||
TMCCJPEGDecState* state;
|
||||
u32 tileRow;
|
||||
u32 tileWidth;
|
||||
s32 tileOffset;
|
||||
s32 row;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
state = work->pState;
|
||||
tileWidth = state->convWidth >> 3;
|
||||
lumaTexture = state->pLumaBuffer;
|
||||
if (state->dataSizeX == (u32)x) {
|
||||
width = state->stepXExt;
|
||||
} else {
|
||||
width = 8 / state->scaleFactor;
|
||||
}
|
||||
if (state->dataSizeY == (u32)y) {
|
||||
height = state->stepYExt;
|
||||
} else {
|
||||
height = 8 / state->scaleFactor;
|
||||
}
|
||||
{
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (row = y; row < yEnd; row++) {
|
||||
for (column = x; column < xEnd; column += 1) {
|
||||
tileRow = (row >> 2) * tileWidth;
|
||||
tileOffset = ((column >> 3) + tileRow) << 5;
|
||||
output = lumaTexture + ((row & 3) << 3) + (column & 7);
|
||||
output[tileOffset] = *luminance++;
|
||||
}
|
||||
luminance += 8 - width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,18 +130,11 @@ typedef struct EZTXGetParam {
|
||||
wchar_t* candidates; // 0x18
|
||||
u8 maxCandidates; // 0x1C
|
||||
wchar_t firstCandidate; // 0x1E
|
||||
#ifndef TIZISTRING_IMPLEMENTATION
|
||||
u8 wordCandidates; // 0x1F
|
||||
#endif
|
||||
|
||||
u8 count; // 0x20
|
||||
u8 letters; // 0x21
|
||||
#ifdef TIZISTRING_IMPLEMENTATION
|
||||
u8 completion;
|
||||
u8* scratch;
|
||||
#else
|
||||
u8* scratch; // 0x22
|
||||
#endif
|
||||
} EZTXGetParam;
|
||||
|
||||
u16 EZTXGetGlobalDataSize();
|
||||
|
||||
@@ -142,9 +142,6 @@ typedef struct ziFuzzyZYPairs {
|
||||
int rANDn : 1;
|
||||
int bANDp : 1;
|
||||
int gANDk : 1;
|
||||
int dANDt : 1;
|
||||
|
||||
int reserved : 20;
|
||||
} ziFuzzyZYPairs;
|
||||
|
||||
typedef struct _ziGetParam {
|
||||
@@ -360,8 +357,8 @@ typedef struct ziMatchParam {
|
||||
ziWChar first2; // 0x68
|
||||
ziWChar comp; // 0x6A
|
||||
ziU8 nSeg; // 0x6C
|
||||
ziU8 segs1[16][12]; // 0x6D
|
||||
ziU8 segsD[16][12]; // 0x12D
|
||||
ziU8 segs1[0xC0]; // 0x6D
|
||||
ziU8 segsD[0xC0]; // 0x12D
|
||||
ziU8 pad_0x1ED; // 0x1ED
|
||||
} ziMatchParam;
|
||||
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
#include <zi8clib/zconvert.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
|
||||
typedef struct ziConversionRange {
|
||||
ziU16 first, last;
|
||||
union { ziPtr table; ziU32 character; } result;
|
||||
} ziConversionRange;
|
||||
typedef struct ziConversionRangeTable {
|
||||
ziU16 count, flags;
|
||||
ziConversionRange* entries;
|
||||
} ziConversionRangeTable;
|
||||
typedef struct ziConversionTables {
|
||||
ziU16 first, last;
|
||||
ziWChar* unicode;
|
||||
ziConversionRangeTable reverse, keys, cases;
|
||||
} ziConversionTables;
|
||||
typedef struct ziConversionEntry {
|
||||
ziU8 first[2], last[2], flags[2], value[2];
|
||||
} ziConversionEntry;
|
||||
typedef struct ziConversionTable {
|
||||
ziU8 count[2], flags[2], minimum[2], maximum[2];
|
||||
ziConversionEntry entries[1];
|
||||
} ziConversionTable;
|
||||
const ziConversionTables Zi8CvrtTables = {0};
|
||||
ziU16 Zi8GetTableCount(ziU8, ziU8 ZI_NEED_WORK);
|
||||
ziPtr Zi8GetTableAddress(ziU8, ziU8 ZI_NEED_WORK);
|
||||
ziWChar Zi8ConvertUC2UserKey(ziChar, ziU8 ZI_NEED_WORK);
|
||||
|
||||
ziWChar Zi8ConvertUC2WC(ziChar character, ziU8 language ZI_NEED_WORK) {
|
||||
ziU8* table;
|
||||
ziWChar* mapped;
|
||||
ziU8* cursor;
|
||||
ziU16 first, last;
|
||||
const ziConversionTables* defaults;
|
||||
if (character == 0) {
|
||||
Zi8LogError(0x133, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
if (Zi8GetTableCount(language, 6, __zi8_work_data) != 0) {
|
||||
table = Zi8GetTableAddress(language, 6, __zi8_work_data);
|
||||
if (table == 0) {
|
||||
Zi8LogError(0x6A4, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
cursor = table;
|
||||
first = (ziU16)cursor[0] << 8 | cursor[1];
|
||||
last = (ziU16)cursor[2] << 8 | cursor[3];
|
||||
if (character < first || character > last) {
|
||||
Zi8LogError(0x132, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
cursor += (character - first) * 2 + 8;
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return (ziU16)cursor[0] << 8 | cursor[1];
|
||||
}
|
||||
defaults = &Zi8CvrtTables;
|
||||
if (defaults == 0) {
|
||||
Zi8LogError(0x6A4, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
if (character < defaults->first || character > defaults->last) {
|
||||
Zi8LogError(0x132, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
mapped = defaults->unicode;
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return mapped[character - defaults->first];
|
||||
}
|
||||
ziChar Zi8ConvertWC2UC(ziWChar character, ziU8 language ZI_NEED_WORK) {
|
||||
ziU16 index, count, value, first, last;
|
||||
ziU8* cursor;
|
||||
ziConversionTable* table;
|
||||
ziConversionRange* ranges;
|
||||
ziConversionEntry* entry;
|
||||
if (character == 0) {
|
||||
Zi8LogError(0x133, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
if (Zi8GetTableCount(language, 7, __zi8_work_data) != 0) {
|
||||
table = Zi8GetTableAddress(language, 7, __zi8_work_data);
|
||||
if (table == 0) {
|
||||
Zi8LogError(0x6AE, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
entry = (ziConversionEntry*)table;
|
||||
count = (ziU16)entry->first[0] << 8 | entry->first[1];
|
||||
entry++;
|
||||
for (index = 0; index < count; index++) {
|
||||
first = (ziU16)entry->first[0] << 8 | entry->first[1];
|
||||
last = (ziU16)entry->last[0] << 8 | entry->last[1];
|
||||
if (character < first || character > last) {
|
||||
entry++;
|
||||
continue;
|
||||
}
|
||||
value = (ziU16)entry->value[0] << 8 | entry->value[1];
|
||||
if (first == last) {
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return value & 0xFF;
|
||||
}
|
||||
entry = (ziConversionEntry*)((ziU8*)table + value + character - first + 8);
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return *(ziU8*)entry;
|
||||
}
|
||||
Zi8LogError(0x6C2, __zi8_work_data);
|
||||
return 0;
|
||||
} else {
|
||||
ranges = Zi8CvrtTables.reverse.entries;
|
||||
if (ranges == 0) {
|
||||
Zi8LogError(0x6AE, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
count = Zi8CvrtTables.reverse.count;
|
||||
for (index = 0; index < count; index++) {
|
||||
if (character >= ranges[index].first && character <= ranges[index].last) {
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
if (ranges[index].first == ranges[index].last)
|
||||
return ranges[index].result.character & 0xFF;
|
||||
cursor = ranges[index].result.table;
|
||||
return cursor[character - ranges[index].first];
|
||||
}
|
||||
}
|
||||
Zi8LogError(0x6C2, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
ziWChar Zi8ConvertUC2Key(ziChar character, ziU8 language ZI_NEED_WORK) {
|
||||
ziU16 key = 0;
|
||||
ziU16 index, count, first, last;
|
||||
ziConversionTable* table;
|
||||
ziWChar* mapped;
|
||||
ziConversionRange* ranges;
|
||||
ziConversionEntry* entry;
|
||||
if (character == 0) {
|
||||
Zi8LogError(0x133, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
if (ZI_WORK->userKeys[language] != 0)
|
||||
return Zi8ConvertUC2UserKey(character, language, __zi8_work_data);
|
||||
if (Zi8GetTableCount(language, 8, __zi8_work_data) != 0) {
|
||||
table = Zi8GetTableAddress(language, 8, __zi8_work_data);
|
||||
if (table == 0) {
|
||||
Zi8LogError(0x6B8, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
entry = (ziConversionEntry*)table;
|
||||
count = (ziU16)entry->first[0] << 8 | entry->first[1];
|
||||
entry++;
|
||||
for (index = 0; index < count; index++) {
|
||||
first = (ziU16)entry->first[0] << 8 | entry->first[1];
|
||||
last = (ziU16)entry->last[0] << 8 | entry->last[1];
|
||||
if (character < first || character > last) {
|
||||
entry++;
|
||||
continue;
|
||||
}
|
||||
key = (ziU16)entry->value[0] << 8 | entry->value[1];
|
||||
if (first == last) break;
|
||||
entry = (ziConversionEntry*)((ziU8*)table + key + (character - first) * 2);
|
||||
entry = (ziConversionEntry*)((ziU8*)entry + 8);
|
||||
key = (ziU16)entry->first[0] << 8 | entry->first[1];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ranges = Zi8CvrtTables.keys.entries;
|
||||
if (ranges == 0) {
|
||||
Zi8LogError(0x6B8, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
count = Zi8CvrtTables.keys.count;
|
||||
for (index = 0; index < count; index++) {
|
||||
if (character >= ranges[index].first && character <= ranges[index].last) {
|
||||
if (ranges[index].first == ranges[index].last) {
|
||||
key = (ziU8)ranges[index].result.character;
|
||||
break;
|
||||
}
|
||||
mapped = ranges[index].result.table;
|
||||
key = mapped[character - ranges[index].first];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (key == 0) {
|
||||
Zi8LogError(0x6C2, __zi8_work_data);
|
||||
return 0xEFF1;
|
||||
} else {
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return key;
|
||||
}
|
||||
}
|
||||
ziWChar Zi8ConvertWC2Key(ziWChar character, ziU8 language ZI_NEED_WORK) {
|
||||
return Zi8ConvertUC2Key(Zi8ConvertWC2UC(character, language, __zi8_work_data), language, __zi8_work_data);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -643,7 +643,7 @@ ziU32 Zi8GetSInfo(ziU8* strokes, ziU8* extraStrokes, ziWChar* outputBuffer, ziU8
|
||||
{
|
||||
int strokeIndex;
|
||||
int outputCount;
|
||||
volatile int extraCount;
|
||||
int extraCount;
|
||||
|
||||
outputCount = 0;
|
||||
Zi8LogError(100, work);
|
||||
@@ -660,7 +660,8 @@ ziU32 Zi8GetSInfo(ziU8* strokes, ziU8* extraStrokes, ziWChar* outputBuffer, ziU8
|
||||
goto lowStroke;
|
||||
}
|
||||
badStroke:
|
||||
outputBuffer[(ziU8)--outputCount] = 0;
|
||||
outputCount--;
|
||||
outputBuffer[(ziU8)outputCount] = 0;
|
||||
return outputCount;
|
||||
lowStroke:
|
||||
outputBuffer[(ziU8)outputCount] = zi8StrokeCode(strokes[strokeIndex] & 0xf, work);
|
||||
|
||||
@@ -1,386 +0,0 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zconvert.h>
|
||||
|
||||
ziU32 Zi8GetTableSize(ziU8 language, ziU8 table, ziPtr work);
|
||||
ziU32 Zi8GetTableAddress(ziU8 language, ziU8 table, ziPtr work);
|
||||
ziU16 Zi8GetTableCount(ziU8 language, ziU8 table, ziPtr work);
|
||||
ziU8* ZiDAWGGetGraph(zi8DawgCtx* context);
|
||||
ziU8* ZiDAWGGetGraphInfo(zi8DawgCtx* context, ziU8* table, ziS16* keys);
|
||||
ziU32 ZiDAWGgetCHARattribute(zi8DawgCtx* context, ziU8* graph, ziPtr work);
|
||||
ziU8 ZiDAWGgetEOWattribute(ziU8* graph);
|
||||
ziU8* ZiDAWGGetChild(ziU8* graph);
|
||||
ziU8* ZiDAWGGetSibling(ziU8* graph);
|
||||
|
||||
ziU32 Zi8MatchROMdata0(ziWChar* elements, ziU8 count, ziU8 language,
|
||||
ziWChar* output, ziU16 capacity, ziU8 mode, ziU8 status,
|
||||
ziU8 graphTable, ziU8 keyTable, ziU8 acceptPrefix,
|
||||
ziU8* prefixLength, zi8DawgCtx* context, ziU8* search,
|
||||
ziPtr __zi8_work_data) {
|
||||
ziU8 result = 0;
|
||||
ziU8* graphData;
|
||||
ziU8* keyData;
|
||||
ziS32 keyCount;
|
||||
ziS32 convertedKey;
|
||||
ziU16 searching;
|
||||
ziU16 key;
|
||||
ziU16 keys[3];
|
||||
ziU16 index;
|
||||
zi8DawgRec* current;
|
||||
zi8DawgRec* records = context->recs;
|
||||
|
||||
if (language != context->lang || graphTable != context->key) records[0].key = 0;
|
||||
if (count == 1 && mode != 0 && graphTable == 0xe) goto finish_graph;
|
||||
if (status != 0) {
|
||||
if (records[context->cnt - 1].node == (ziU8*)context->unk_0x338) goto finish_graph;
|
||||
for (index = 0; index < count; index++) {
|
||||
if (records[index].key != elements[index] &&
|
||||
(ziU16)records[index].attr != elements[index]) goto finish_graph;
|
||||
}
|
||||
if (mode == 1) acceptPrefix = 0;
|
||||
} else {
|
||||
if (ZI_WORK->unk_0x141E != 0 && graphTable == 0xc &&
|
||||
Zi8GetTableSize(language, ZI_WORK->unk_0x141E, ZI_WORK) != 0) {
|
||||
graphData = (ziU8*)Zi8GetTableAddress(language, ZI_WORK->unk_0x141E, ZI_WORK);
|
||||
keyTable = ZI_WORK->unk_0x141E + 1;
|
||||
} else {
|
||||
if (Zi8GetTableSize(language, graphTable, ZI_WORK) == 0) {
|
||||
Zi8LogError(0x961, ZI_WORK);
|
||||
goto finish_graph;
|
||||
}
|
||||
graphData = (ziU8*)Zi8GetTableAddress(language, graphTable, ZI_WORK);
|
||||
}
|
||||
context->table = graphData;
|
||||
context->cap = (((ziU16)context->table[2] << 8) + context->table[3]) / 3;
|
||||
context->p08 = context->table + 4;
|
||||
context->p0C = context->table + context->cap * 2 + 4;
|
||||
context->lang = language;
|
||||
context->key = graphTable;
|
||||
index = 0;
|
||||
while (index < count && records[index].key == elements[index]) index++;
|
||||
if (index >= 2) {
|
||||
records[0].node = records[index - 1].back;
|
||||
} else {
|
||||
key = Zi8GetTableSize(language, keyTable, ZI_WORK);
|
||||
if (key != 0 && ZI_WORK->userKeys[language] == 0) {
|
||||
index = 0;
|
||||
goto check_keys;
|
||||
next_key:
|
||||
{
|
||||
keys[index] = Zi8ConvertWC2Key(elements[index], language, ZI_WORK);
|
||||
if (keys[index] == 0) keys[index] = elements[index];
|
||||
index++;
|
||||
}
|
||||
check_keys:
|
||||
if (count < 2) keyCount = count;
|
||||
else keyCount = 2;
|
||||
if (index < keyCount) goto next_key;
|
||||
keys[index] = 0;
|
||||
keyData = (ziU8*)Zi8GetTableAddress(language, keyTable, ZI_WORK);
|
||||
context->p14 = keyData + 2;
|
||||
keyData += context->cap * 2 + 2;
|
||||
records[0].node = ZiDAWGGetGraphInfo(context, keyData, (ziS16*)keys);
|
||||
} else {
|
||||
records[0].node = ZiDAWGGetGraph(context);
|
||||
context->unk_0x338 = 0;
|
||||
context->p14 = 0;
|
||||
}
|
||||
records[0].key = 0;
|
||||
if (records[0].node == (ziU8*)0) goto finish_graph;
|
||||
}
|
||||
context->cnt = 1;
|
||||
search[1] = count;
|
||||
search[0] = 0;
|
||||
if (mode == 1) {
|
||||
search[0] = 1;
|
||||
acceptPrefix = 0;
|
||||
} else if (mode == 0 && acceptPrefix == 0) search[1]++;
|
||||
}
|
||||
searching = 1;
|
||||
current = &records[context->cnt - 1];
|
||||
while (searching && context->cnt != 0 && current->node != (ziU8*)context->unk_0x338) {
|
||||
if (capacity < context->cnt) goto finish_graph;
|
||||
current->attr = ZiDAWGgetCHARattribute(context, current->node, ZI_WORK);
|
||||
if (context->cnt <= count) {
|
||||
if (context->p14 == 0) {
|
||||
convertedKey = Zi8ConvertWC2Key((ziU16)current->attr, language, ZI_WORK);
|
||||
} else {
|
||||
convertedKey = ((ziU16)context->p14[(current->attr >> 24) * 2] << 8) +
|
||||
(context->p14 + (current->attr >> 24) * 2)[1];
|
||||
}
|
||||
key = convertedKey;
|
||||
if (key != elements[context->cnt - 1] &&
|
||||
(ziU16)current->attr != elements[context->cnt - 1]) goto next_sibling;
|
||||
if (current->key != elements[context->cnt - 1]) {
|
||||
current->key = elements[context->cnt - 1];
|
||||
current->back = records[0].node;
|
||||
records[context->cnt].key = 0;
|
||||
}
|
||||
if (prefixLength != 0 && *prefixLength < context->cnt &&
|
||||
ZiDAWGgetEOWattribute(current->node) != 0) {
|
||||
*prefixLength = context->cnt;
|
||||
for (index = 0; index < context->cnt; index++) output[index] = (ziU16)records[index].attr;
|
||||
}
|
||||
if (context->cnt < count) goto descend;
|
||||
}
|
||||
if (context->cnt < search[1]) goto descend;
|
||||
if (search[0] != 0 && context->cnt > search[1]) goto next_sibling;
|
||||
if (acceptPrefix != 0 || ZiDAWGgetEOWattribute(current->node) != 0) {
|
||||
for (index = 0; index < context->cnt; index++) output[index] = (ziU16)records[index].attr;
|
||||
result = context->cnt;
|
||||
searching = 0;
|
||||
if (acceptPrefix != 0) goto next_sibling;
|
||||
}
|
||||
if (search[0] != 0 && context->cnt >= search[1]) goto next_sibling;
|
||||
descend:
|
||||
records[context->cnt].node = ZiDAWGGetChild(records[context->cnt - 1].node);
|
||||
if (records[context->cnt].node == (ziU8*)0) goto next_sibling;
|
||||
context->cnt++;
|
||||
if (ZI_WORK->unk_0x141F < context->cnt) ZI_WORK->unk_0x141F = context->cnt;
|
||||
goto update_current;
|
||||
next_sibling:
|
||||
while (context->cnt != 0) {
|
||||
records[context->cnt - 1].node = ZiDAWGGetSibling(records[context->cnt - 1].node);
|
||||
if (records[context->cnt - 1].node != (ziU8*)0) break;
|
||||
context->cnt--;
|
||||
}
|
||||
update_current:
|
||||
current = &records[context->cnt - 1];
|
||||
}
|
||||
finish_graph:
|
||||
return result;
|
||||
}
|
||||
ziU8* NextDawgGroup(ziU8* group, ziU8 language, ziPtr __zi8_work_data)
|
||||
{
|
||||
if (Zi8GetTableSize(language,0x1c,ZI_WORK) != 0) {
|
||||
if (group == 0) {
|
||||
group = (ziU8*)Zi8GetTableAddress(language,0x1c,ZI_WORK);
|
||||
if (group == 0) {
|
||||
Zi8LogError(0x962,ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
if (ZI_WORK->unk_0x141D == 0) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
while (group[0] != 0xff || group[1] != 0xff) {
|
||||
group = group + 1;
|
||||
}
|
||||
group = group + 2;
|
||||
if (group[0] == 0xff) {
|
||||
Zi8LogError(0x963,ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
return group;
|
||||
}
|
||||
Zi8LogError(0x961,ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int Zi8MatchROMdata1(ziWChar *elements, ziU8 count, ziU8 language, ziWChar *output, ziU16 capacity, ziU8 mode, ziU8 status, ziU32 groupIndex, char *group, ziU8 acceptPrefix, ziPtr __zi8_work_data)
|
||||
{
|
||||
unsigned int result;
|
||||
ziU32 tableAddress;
|
||||
|
||||
result = 0;
|
||||
if (status == 0) {
|
||||
ZI_WORK->unk_0x1764 = (ziU8*)group;
|
||||
if (ZI_WORK->unk_0x1764 == 0) {
|
||||
if (Zi8GetTableSize(language & 0xff,0xb,ZI_WORK) != 0) {
|
||||
tableAddress = Zi8GetTableAddress(language & 0xff,0xb,ZI_WORK);
|
||||
ZI_WORK->unk_0x1764 = (ziU8*)tableAddress;
|
||||
}
|
||||
}
|
||||
if (ZI_WORK->unk_0x1764 != 0) {
|
||||
for (; (*ZI_WORK->unk_0x1764 != 0xff && ((groupIndex & 0xff) != 0));
|
||||
groupIndex = groupIndex - 1) {
|
||||
while (*ZI_WORK->unk_0x1764 != 0xff) {
|
||||
ZI_WORK->unk_0x1764 += 2;
|
||||
}
|
||||
ZI_WORK->unk_0x1764++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ZI_WORK->unk_0x1764 == 0) {
|
||||
result = Zi8MatchROMdata0(elements,count,language & 0xff,output,capacity & 0xffff,
|
||||
mode & 0xff,status & 0xff,0,1,acceptPrefix,0,&ZI_WORK->dawgCtx,
|
||||
ZI_WORK->unk_0x1760,ZI_WORK);
|
||||
}
|
||||
else {
|
||||
while (*ZI_WORK->unk_0x1764 != 0xff) {
|
||||
result = Zi8MatchROMdata0(elements,count,language & 0xff,output,
|
||||
capacity & 0xffff,mode & 0xff,status & 0xff,
|
||||
*ZI_WORK->unk_0x1764,
|
||||
ZI_WORK->unk_0x1764[1],acceptPrefix,0,
|
||||
&ZI_WORK->dawgCtx,ZI_WORK->unk_0x1760,ZI_WORK);
|
||||
if ((result & 0xff) != 0) break;
|
||||
ZI_WORK->unk_0x1764 += 2;
|
||||
status = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned int Zi8MatchROMdata2(ziWChar* elements, ziU8 count, ziU8 language,
|
||||
ziWChar* output, ziU16 capacity, ziU8 mode,
|
||||
ziU8 status, ziU8 reservedMode, ziU8* group,
|
||||
ziU8 acceptPrefix, ziPtr __zi8_work_data) {
|
||||
unsigned int result = 0;
|
||||
ziU8 index;
|
||||
|
||||
if (reservedMode != 0) return 0;
|
||||
if (status == 0) {
|
||||
ZI_WORK->unk_0x1768 = 0;
|
||||
ZI_WORK->unk_0x17EA = 0;
|
||||
if (group != 0 && *group == 0xc && language == 10 && ZI_WORK->unk_0x141C != 0) {
|
||||
ZI_WORK->unk_0x141E = 0x10;
|
||||
} else {
|
||||
ZI_WORK->unk_0x141E = 0;
|
||||
}
|
||||
}
|
||||
search_segment:
|
||||
ZI_WORK->unk_0x141F = 1;
|
||||
result = Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA,
|
||||
count - ZI_WORK->unk_0x17EA, language,
|
||||
&ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
|
||||
mode, status, ZI_WORK->unk_0x1768, (char*)group,
|
||||
acceptPrefix, ZI_WORK);
|
||||
if ((ziU8)result != 0) {
|
||||
for (index = (ziU8)(ZI_WORK->unk_0x17EA + result); index != 0; index--) {
|
||||
output[index - 1] = ZI_WORK->unk_0x17F4[index - 1];
|
||||
}
|
||||
result = (ziU8)(result + ZI_WORK->unk_0x17EA);
|
||||
} else {
|
||||
if (status != 0 || count == 1) goto finish_segments;
|
||||
if (mode == 1 && ZI_WORK->unk_0x1768 == 0 &&
|
||||
(ziU8)Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA,
|
||||
count - ZI_WORK->unk_0x17EA, language,
|
||||
&ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
|
||||
0, status, ZI_WORK->unk_0x1768, (char*)group,
|
||||
acceptPrefix, ZI_WORK) != 0) goto finish_segments;
|
||||
if ((Zi8GetTableCount(language, 0x1f, ZI_WORK) & 4) == 0) {
|
||||
for (index = 0; index < count; index++) {
|
||||
if (elements[index] == 0xeff1) goto finish_segments;
|
||||
}
|
||||
}
|
||||
if (ZI_WORK->unk_0x141F > capacity) goto finish_segments;
|
||||
for (index = ZI_WORK->unk_0x141F; index != 0; index--) {
|
||||
result = Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA, index, language,
|
||||
&ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
|
||||
1, 0, ZI_WORK->unk_0x1768, (char*)group,
|
||||
acceptPrefix, ZI_WORK);
|
||||
if ((ziU8)result != 0) {
|
||||
ZI_WORK->unk_0x17EA += (ziU8)result;
|
||||
if (ZI_WORK->unk_0x17EA == count) return 0;
|
||||
ZI_WORK->unk_0x1768++;
|
||||
status = 0;
|
||||
ZI_WORK->unk_0x141E = 0;
|
||||
if (ZI_WORK->dawgCtx.key == 0 && language == 10) {
|
||||
for (index = 0; index < ZI_WORK->unk_0x17EA; index++) {
|
||||
switch (ZI_WORK->unk_0x17F4[index]) {
|
||||
case 0x61:
|
||||
case 0x6f:
|
||||
case 0x75:
|
||||
ZI_WORK->unk_0x141E = 0x10;
|
||||
goto search_segment;
|
||||
}
|
||||
}
|
||||
}
|
||||
goto search_segment;
|
||||
}
|
||||
}
|
||||
}
|
||||
finish_segments:
|
||||
return result;
|
||||
}
|
||||
|
||||
ziU32 Zi8MatchROMdata(ziWChar* elements, ziU8 count, ziU8 language,
|
||||
ziWChar* output, ziU16 capacity, ziU8 mode, ziU8 status,
|
||||
ziU8 reservedMode, ziU8 acceptPrefix, ziPtr __zi8_work_data) {
|
||||
ziU32 result = 0;
|
||||
ziS32 tableSize = 0;
|
||||
|
||||
if (capacity < count) {
|
||||
Zi8LogError(0x321, ZI_WORK);
|
||||
} else if (status == 2) {
|
||||
Zi8LogError(100, ZI_WORK);
|
||||
} else {
|
||||
if (status == 0) {
|
||||
ZI_WORK->unk_0x17EC = 0;
|
||||
ZI_WORK->unk_0x17F0 = NextDawgGroup(0, language, ZI_WORK);
|
||||
} else if (ZI_WORK->unk_0x17EC != 0) {
|
||||
Zi8LogError(100, ZI_WORK);
|
||||
goto finish_match;
|
||||
}
|
||||
tableSize = Zi8GetTableSize(language, 0x1c, ZI_WORK);
|
||||
if (tableSize == 0) {
|
||||
result = Zi8MatchROMdata2(elements, count, language, output, capacity,
|
||||
mode, status, reservedMode, 0, acceptPrefix, ZI_WORK);
|
||||
} else {
|
||||
while (ZI_WORK->unk_0x17F0 != 0) {
|
||||
result = Zi8MatchROMdata2(elements, count, language, output, capacity,
|
||||
mode, status, reservedMode, ZI_WORK->unk_0x17F0,
|
||||
acceptPrefix, ZI_WORK);
|
||||
if ((ziU8)result != 0) break;
|
||||
status = 0;
|
||||
if (count <= 1 && language == 0x36) break;
|
||||
ZI_WORK->unk_0x17F0 = NextDawgGroup(ZI_WORK->unk_0x17F0, language, ZI_WORK);
|
||||
}
|
||||
}
|
||||
if ((ziU8)result == 0 && status == 0 && mode == 1 && count == 1 && capacity >= 1) {
|
||||
mode = 0;
|
||||
ZI_WORK->unk_0x17EC = 1;
|
||||
if (tableSize != 0) {
|
||||
ZI_WORK->unk_0x17F0 = NextDawgGroup(0, language, ZI_WORK);
|
||||
while (ZI_WORK->unk_0x17F0 != 0) {
|
||||
if ((ziU8)Zi8MatchROMdata2(elements, count, language, output, capacity,
|
||||
mode, status, reservedMode, ZI_WORK->unk_0x17F0,
|
||||
acceptPrefix, ZI_WORK) != 0) {
|
||||
*output = *elements;
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
ZI_WORK->unk_0x17F0 = NextDawgGroup(ZI_WORK->unk_0x17F0, language, ZI_WORK);
|
||||
}
|
||||
} else {
|
||||
if ((ziU8)Zi8MatchROMdata2(elements, count, language, output, capacity,
|
||||
mode, status, reservedMode, 0, acceptPrefix, ZI_WORK) != 0) {
|
||||
*output = *elements;
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Zi8LogError(100, ZI_WORK);
|
||||
}
|
||||
finish_match:
|
||||
return result;
|
||||
}
|
||||
|
||||
void Zi8SyllablesROMdata(ziWChar *elements, ziU8 count, ziU8 language, ziWChar *output, ziU16 capacity, ziU8 status, ziU8* prefixLength, ziU8 reverseOrder, ziPtr __zi8_work_data)
|
||||
{
|
||||
ziU32 keyTable;
|
||||
ziU8 graphTable;
|
||||
|
||||
graphTable = 0x1a;
|
||||
keyTable = 0x1b;
|
||||
if (prefixLength != 0) {
|
||||
*prefixLength = 0;
|
||||
}
|
||||
if (reverseOrder != 0) {
|
||||
graphTable = 0x18;
|
||||
keyTable = 0x19;
|
||||
}
|
||||
if (Zi8GetTableSize(language & 0xff,graphTable,ZI_WORK) == 0) {
|
||||
if (graphTable == 0x1a) {
|
||||
graphTable = 0x18;
|
||||
keyTable = 0x19;
|
||||
}
|
||||
else {
|
||||
graphTable = 0x1a;
|
||||
keyTable = 0x1b;
|
||||
}
|
||||
}
|
||||
Zi8MatchROMdata0(elements,count,language & 0xff,output,capacity,1,status,graphTable,keyTable,0,(ziU8 *)prefixLength,
|
||||
&ZI_WORK->dawgCtx,ZI_WORK->unk_0x1760,ZI_WORK);
|
||||
return;
|
||||
}
|
||||
@@ -1,716 +0,0 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zi8getc2.h>
|
||||
|
||||
typedef struct {
|
||||
ziU8 countOnly;
|
||||
ziU8 maxWordLength;
|
||||
ziU8 lookupMode;
|
||||
ziU8 suffixOnly;
|
||||
ziU8 controls[8];
|
||||
ziU32 maxCount;
|
||||
ziU16 capacity;
|
||||
ziU8 minWordLength;
|
||||
ziU8 flags;
|
||||
ziU16 candidateCapacity;
|
||||
ziU8 checkOnly;
|
||||
ziU8 reserved;
|
||||
} ZiCandidateOptions;
|
||||
|
||||
const ziU8 Zi8SOdefaultArray[16] = {1, 4, 3, 2, 1, 8, 7, 6, 5, 0};
|
||||
const ziFuzzyPYPairs Zi8PYdefaultFuzzyPairs = {0, 1, 1, 1, 1, 1, 1};
|
||||
const ziFuzzyZYPairs Zi8ZYdefaultFuzzyPairs = {0};
|
||||
|
||||
ziU8 Zi8GetFormatVersion(ziU8 language, ziPtr work);
|
||||
ziU32 Zi8GetTableAddress(ziU8 language, ziU8 table, ziPtr work);
|
||||
ziU16 Zi8GetTableCount(ziU8 language, ziU8 table, ziPtr work);
|
||||
ziU16 Zi8GetVersion(ziPtr work);
|
||||
ziU16 Zi8GetOEMID(ziPtr work);
|
||||
ziU16 Zi8GetBuildID(ziPtr work);
|
||||
void Zi8Memcpy(ziU8* destination, ziU8* source, ziS32 count);
|
||||
ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* options, ziPtr work);
|
||||
|
||||
ziBool Zi8ZHsetPYfuzzyPairs(ziFuzzyPYPairs pairs ZI_NEED_WORK) {
|
||||
if (pairs.ziDefault) {
|
||||
ZI_WORK->unk_0x1B28.word = *(const ziU32*)&Zi8PYdefaultFuzzyPairs;
|
||||
} else {
|
||||
ZI_WORK->unk_0x1B28.word = *(ziU32*)&pairs;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
ziBool Zi8ZHsetZYfuzzyPairs(ziFuzzyZYPairs pairs ZI_NEED_WORK) {
|
||||
if (pairs.ziDefault) {
|
||||
ZI_WORK->unk_0x1B2C.word = *(const ziU32*)&Zi8ZYdefaultFuzzyPairs;
|
||||
} else {
|
||||
ZI_WORK->unk_0x1B2C.word = *(ziU32*)&pairs;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
ziBool Zi8SetLatinSearchOrder(ziU8* searchArray, ziU8 searchSize ZI_NEED_WORK) {
|
||||
if (searchArray == 0 || *searchArray == 0) {
|
||||
ZI_WORK->unk_0x1410 = (ziU32)Zi8SOdefaultArray;
|
||||
ZI_WORK->unk_0x1418 = 9;
|
||||
} else {
|
||||
ZI_WORK->unk_0x1410 = (ziU32)searchArray;
|
||||
ZI_WORK->unk_0x1418 = searchSize;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
ziU16 Zi8GetGlobalDataSize(void) {
|
||||
return sizeof(struct __zi8_work_data_s);
|
||||
}
|
||||
|
||||
static ziU16 Zi8GetDataSignature(ziU8* destination, ziU16 capacity, ziU8 language, ziPtr work) {
|
||||
ziU8* signature;
|
||||
ziU16 length;
|
||||
if (language == 1) {
|
||||
if (Zi8GetFormatVersion(1, work) < 8) {
|
||||
Zi8LogError(0x26f, work);
|
||||
return 0;
|
||||
}
|
||||
length = 0x1e;
|
||||
} else {
|
||||
length = 3;
|
||||
}
|
||||
signature = (ziU8*)Zi8GetTableAddress(language, (ziU8)length, work);
|
||||
length = Zi8GetTableCount(language, (ziU8)length, work);
|
||||
if (length == 0 || length > capacity) {
|
||||
Zi8LogError(0x961, work);
|
||||
return 0;
|
||||
}
|
||||
Zi8Memcpy(destination, signature, length);
|
||||
destination[length] = 0;
|
||||
Zi8LogError(100, work);
|
||||
return length;
|
||||
}
|
||||
|
||||
static ziU16 Zi8GetEngineSignature(ziU8* destination, ziPtr work) {
|
||||
ziU16 index = 0;
|
||||
struct { ziU16 minor; } version;
|
||||
ziU16 number;
|
||||
destination[index++] = 'v';
|
||||
number = (Zi8GetVersion(work) & 0xff00) >> 8;
|
||||
version.minor = Zi8GetVersion(work) & 0xff;
|
||||
destination[index++] = (ziU8)(number / 10 + '0');
|
||||
destination[index++] = (ziU8)(number % 10 + '0');
|
||||
destination[index++] = (ziU8)(version.minor / 10 + '0');
|
||||
destination[index++] = (ziU8)(version.minor % 10 + '0');
|
||||
destination[index++] = 'o';
|
||||
number = Zi8GetOEMID(work);
|
||||
destination[index++] = (ziU8)(number / 100 + '0');
|
||||
destination[index++] = (ziU8)((number % 100) / 10 + '0');
|
||||
destination[index++] = (ziU8)((number % 100) % 10 + '0');
|
||||
destination[index++] = 'b';
|
||||
number = Zi8GetBuildID(work);
|
||||
destination[index++] = (ziU8)(number / 100 + '0');
|
||||
destination[index++] = (ziU8)((number % 100) / 10 + '0');
|
||||
destination[index++] = (ziU8)((number % 100) % 10 + '0');
|
||||
destination[index] = 0;
|
||||
return index;
|
||||
}
|
||||
|
||||
static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED_WORK) {
|
||||
ziU16 secondLength;
|
||||
struct { ziU16 length; ziU8* second; ziU8* first; } signatures;
|
||||
ziU8 dictionary[32];
|
||||
ziU8 engine[32];
|
||||
ziU16 length;
|
||||
ziU8* current;
|
||||
ziWChar* output = parameters->candidates;
|
||||
|
||||
signatures.first = 0;
|
||||
signatures.second = 0;
|
||||
signatures.length = 0;
|
||||
secondLength = 0;
|
||||
Zi8LogError(100, ZI_WORK);
|
||||
parameters->letters = 0;
|
||||
length = Zi8GetDataSignature(dictionary, 0x20, parameters->language, ZI_WORK);
|
||||
if (length != 0 && parameters->elementCount <= length) {
|
||||
signatures.first = dictionary;
|
||||
signatures.second = engine;
|
||||
signatures.length = length;
|
||||
} else {
|
||||
signatures.first = engine;
|
||||
}
|
||||
length = Zi8GetEngineSignature(engine, ZI_WORK);
|
||||
if (length < parameters->elementCount) {
|
||||
if (signatures.length != 0) {
|
||||
signatures.second = 0;
|
||||
length = 1;
|
||||
} else {
|
||||
Zi8ReplaceLastError(500, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
} else if (signatures.length != 0) {
|
||||
secondLength = length;
|
||||
length = 2;
|
||||
} else {
|
||||
signatures.length = length;
|
||||
length = 1;
|
||||
}
|
||||
if (parameters->firstCandidate >= length) {
|
||||
Zi8ReplaceLastError(501, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
length = length - parameters->firstCandidate;
|
||||
if (countOnly != 0) {
|
||||
parameters->letters = length;
|
||||
ZI_WORK->unk_0x0A = 0xff;
|
||||
return 1;
|
||||
}
|
||||
if (parameters->maxCandidates < length) length = parameters->maxCandidates;
|
||||
parameters->letters = length;
|
||||
if ((parameters->getOptions & 0x80) == 0) {
|
||||
ZI_WORK->unk_0x538 = parameters->language;
|
||||
parameters->candidates[0] = 0xfff0;
|
||||
output = (ziWChar*)&ZI_WORK->unk_0x338;
|
||||
}
|
||||
if (parameters->firstCandidate != 0) {
|
||||
current = signatures.second;
|
||||
length = secondLength;
|
||||
} else {
|
||||
current = signatures.first;
|
||||
length = signatures.length;
|
||||
}
|
||||
if (length > ZI_WORK->unk_0x0A) length = ZI_WORK->unk_0x0A;
|
||||
if ((parameters->elementCount < ZI_WORK->unk_0x140C[0] ||
|
||||
(parameters->getOptions & 0x7e) == 2) && length > parameters->elementCount) {
|
||||
length = parameters->elementCount;
|
||||
}
|
||||
while (length-- != 0) *output++ = (ziU8)*current++;
|
||||
*output++ = 0;
|
||||
if (parameters->letters == 2) {
|
||||
current = signatures.second;
|
||||
length = secondLength;
|
||||
if (length > ZI_WORK->unk_0x0A) length = ZI_WORK->unk_0x0A;
|
||||
if ((parameters->elementCount < ZI_WORK->unk_0x140C[0] ||
|
||||
(parameters->getOptions & 0x7e) == 2) && length > parameters->elementCount) {
|
||||
length = parameters->elementCount;
|
||||
}
|
||||
while (length-- != 0) *output++ = (ziU8)*current++;
|
||||
*output++ = 0;
|
||||
}
|
||||
*output++ = 0;
|
||||
ZI_WORK->unk_0x0A = 0xff;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ziBool Zi8ZhSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED_WORK) {
|
||||
ziWChar* output = parameters->candidates;
|
||||
ziU8* current = 0;
|
||||
ziU16 copied;
|
||||
ziU8 dictionary[32];
|
||||
ziU8 engine[32];
|
||||
ziU16 dataLength;
|
||||
ziU16 engineLength;
|
||||
ziU16 length;
|
||||
|
||||
Zi8LogError(100, ZI_WORK);
|
||||
parameters->letters = 0;
|
||||
dataLength = Zi8GetDataSignature(dictionary, 0x20, parameters->language, ZI_WORK);
|
||||
engineLength = Zi8GetEngineSignature(engine, ZI_WORK);
|
||||
if ((parameters->context & 0x10) != 0) {
|
||||
length = 0;
|
||||
if (dataLength != 0) length++;
|
||||
if (engineLength != 0) length++;
|
||||
} else {
|
||||
length = dataLength + engineLength;
|
||||
}
|
||||
if (parameters->firstCandidate >= length) {
|
||||
Zi8ReplaceLastError(502, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
length = length - parameters->firstCandidate;
|
||||
if (countOnly != 0) {
|
||||
parameters->letters = length;
|
||||
ZI_WORK->unk_0x0A = 0xff;
|
||||
return 1;
|
||||
}
|
||||
if (parameters->maxCandidates < length) length = parameters->maxCandidates;
|
||||
parameters->letters = length;
|
||||
if ((parameters->context & 0x10) != 0) {
|
||||
if (parameters->firstCandidate != 0 || dataLength == 0) {
|
||||
if (parameters->firstCandidate != 0 && dataLength == 0) {
|
||||
Zi8ReplaceLastError(500, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
current = engine;
|
||||
length = engineLength;
|
||||
} else {
|
||||
current = dictionary;
|
||||
length = dataLength;
|
||||
}
|
||||
while (length-- != 0) *output++ = (ziU8)*current++;
|
||||
*output++ = 0x20;
|
||||
if (parameters->letters == 2) {
|
||||
current = engine;
|
||||
length = engineLength;
|
||||
while (length-- != 0) *output++ = (ziU8)*current++;
|
||||
*output++ = 0x20;
|
||||
}
|
||||
} else {
|
||||
copied = 0;
|
||||
if (dataLength != 0) {
|
||||
if (parameters->firstCandidate >= dataLength) {
|
||||
length = 0;
|
||||
} else {
|
||||
length = dataLength - parameters->firstCandidate;
|
||||
current = dictionary + parameters->firstCandidate;
|
||||
}
|
||||
if (parameters->letters < length) length = parameters->letters;
|
||||
copied = length;
|
||||
while (length-- != 0) *output++ = (ziU8)*current++;
|
||||
}
|
||||
current = engine;
|
||||
if (parameters->firstCandidate >= dataLength) {
|
||||
length = dataLength + (engineLength - parameters->firstCandidate);
|
||||
current += engineLength - length;
|
||||
} else {
|
||||
length = engineLength;
|
||||
}
|
||||
if (parameters->letters - copied < length) length = parameters->letters - copied;
|
||||
while (length-- != 0) *output++ = (ziU8)*current++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
ziU8 _Zi8GetCandidates(ziGetParam* parameters ZI_NEED_WORK) {
|
||||
ZiCandidateOptions options = {0};
|
||||
options.capacity = ZI_WORK->unk_0x141A;
|
||||
return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK);
|
||||
}
|
||||
|
||||
ziU8 _Zi8CheckCandidates(ziGetParam* parameters ZI_NEED_WORK) {
|
||||
ZiCandidateOptions options = {0};
|
||||
options.capacity = ZI_WORK->unk_0x141A;
|
||||
options.flags = 1;
|
||||
return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK);
|
||||
}
|
||||
ziU8 Zi8LangSupported(ziU8 language, ziPtr work);
|
||||
ziBool Zi8IsCharacter(ziWChar character, ziPtr work);
|
||||
ziU8 Zi8GetCharInfo(ziWChar character, ziWChar* output, ziU8 capacity, ziU8 type, ziPtr work);
|
||||
ziU32 Zi8GetKOcandidates(ziGetParam* parameters, ziPtr options, ziPtr work);
|
||||
ziU32 Zi8GetKoreanCandidates(ziGetParam* parameters, ziPtr options, ziPtr work);
|
||||
ziU32 Zi8Punctuation(ziGetParam* parameters, ziPtr options, ziPtr work);
|
||||
ziU32 Zi8GetChineseCandidates(ziGetParam* parameters, ziPtr options, ziPtr work);
|
||||
ziU32 Zi8Get1KeyPressCandidates(ziGetParam* parameters, ziPtr options, ziPtr work);
|
||||
ziU32 Zi8Get1KeyPressSpelling(ziGetParam* parameters, ziPtr options, ziPtr work);
|
||||
ziU32 Zi8GetSyllablesCandidates(ziGetParam* parameters, ziPtr options, ziPtr work);
|
||||
ziU32 Zi8AlphaGetCandidates(ziGetParam* parameters, ziPtr options, ziPtr work);
|
||||
|
||||
ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* options ZI_NEED_WORK) {
|
||||
|
||||
ziU16 characterInfo[16];
|
||||
struct {
|
||||
ziU8 savedGetMode;
|
||||
ziU8 savedElementCount;
|
||||
ziU8 convertedElementCount;
|
||||
ziBool restoreCandidates;
|
||||
ziU8 savedOptions;
|
||||
ziU16 savedCharacter;
|
||||
ziU16 lastInfoCharacter;
|
||||
ziWChar* savedElements;
|
||||
ziWChar* savedCandidates;
|
||||
} saved;
|
||||
ziU8 outputIndex;
|
||||
ziU16 error;
|
||||
unsigned int candidateCount;
|
||||
|
||||
error = 0;
|
||||
saved.savedOptions = 0;
|
||||
saved.savedCandidates = 0;
|
||||
saved.restoreCandidates = 0;
|
||||
if (options->lookupMode == '\0') {
|
||||
if (((ZI_WORK->unk_0x00 == '\t') && (parameters->elementCount != 0)) &&
|
||||
(((parameters->elements[parameters->elementCount - 1] == 0xEFF8 &&
|
||||
((ziU8)Zi8AlphaSignature(parameters,options->countOnly,ZI_WORK) != 0)) ||
|
||||
((parameters->elements[parameters->elementCount - 1] == 0xEF04 &&
|
||||
((ziU8)Zi8ZhSignature(parameters,options->countOnly,ZI_WORK) != 0)))))) {
|
||||
candidateCount = (unsigned int)parameters->letters;
|
||||
if (options->countOnly != '\0') {
|
||||
parameters->letters = 0;
|
||||
}
|
||||
Zi8LogError(100,ZI_WORK);
|
||||
return candidateCount;
|
||||
}
|
||||
if ((parameters->elementCount == 1) && (parameters->firstCandidate == 0)) {
|
||||
switch (parameters->language) {
|
||||
case 1:
|
||||
if ((ZI_WORK->unk_0x00 == '\0') || (ZI_WORK->unk_0x01 == options->countOnly)) {
|
||||
switch(ZI_WORK->unk_0x00) {
|
||||
case '\0':
|
||||
if (parameters->elements[0] == 0xEF04) {
|
||||
ZI_WORK->unk_0x01 = options->countOnly;
|
||||
ZI_WORK->unk_0x00 = '\x01';
|
||||
}
|
||||
break;
|
||||
case '\x02':
|
||||
case '\x04':
|
||||
case '\x06':
|
||||
if (parameters->elements[0] == 0xEF04) {
|
||||
++ZI_WORK->unk_0x00;
|
||||
}
|
||||
else {
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
break;
|
||||
case '\x01':
|
||||
case '\x03':
|
||||
case '\x05':
|
||||
case '\a':
|
||||
if (parameters->elements[0] == 0xEF01) {
|
||||
++ZI_WORK->unk_0x00;
|
||||
}
|
||||
else {
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
break;
|
||||
case '\b':
|
||||
case '\t':
|
||||
if ((parameters->elements[0] == 0xEF04) &&
|
||||
((ziU8)Zi8ZhSignature(parameters,options->countOnly,ZI_WORK) != 0)) {
|
||||
ZI_WORK->unk_0x00 = '\t';
|
||||
candidateCount = (unsigned int)parameters->letters;
|
||||
if (options->countOnly != '\0') {
|
||||
parameters->letters = 0;
|
||||
}
|
||||
Zi8LogError(100,ZI_WORK);
|
||||
return candidateCount;
|
||||
}
|
||||
default:
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
if ((ZI_WORK->unk_0x00 == '\0') && (parameters->elements[0] == 0xEF04)) {
|
||||
ZI_WORK->unk_0x00 = '\x01';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x10:
|
||||
case 0x12:
|
||||
case 0x77:
|
||||
case 0x78:
|
||||
case 0x79:
|
||||
case 0x7A:
|
||||
case 0x7B:
|
||||
case 0x7C:
|
||||
case 0x7D:
|
||||
break;
|
||||
case 0x11:
|
||||
default:
|
||||
if ((ZI_WORK->unk_0x00 == '\0') || (ZI_WORK->unk_0x01 == options->countOnly)) {
|
||||
switch(ZI_WORK->unk_0x00) {
|
||||
case '\0':
|
||||
if (parameters->elements[0] == 0xEFF2) {
|
||||
ZI_WORK->unk_0x01 = options->countOnly;
|
||||
ZI_WORK->unk_0x00 = '\x01';
|
||||
}
|
||||
break;
|
||||
case '\x01':
|
||||
if (parameters->elements[0] == 0xEFF3) {
|
||||
ZI_WORK->unk_0x00 = '\x02';
|
||||
}
|
||||
else {
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
break;
|
||||
case '\x02':
|
||||
if (parameters->elements[0] == 0xEFF5) {
|
||||
ZI_WORK->unk_0x00 = '\x03';
|
||||
}
|
||||
else {
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
break;
|
||||
case '\x03':
|
||||
if (parameters->elements[0] == 0xEFF7) {
|
||||
ZI_WORK->unk_0x00 = '\x04';
|
||||
}
|
||||
else {
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
break;
|
||||
case '\x04':
|
||||
if (parameters->elements[0] == 0xEFF8) {
|
||||
ZI_WORK->unk_0x00 = '\x05';
|
||||
}
|
||||
else {
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
break;
|
||||
case '\x05':
|
||||
if (parameters->elements[0] == 0xEFF9) {
|
||||
ZI_WORK->unk_0x00 = '\x06';
|
||||
}
|
||||
else {
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
break;
|
||||
case '\x06':
|
||||
if (parameters->elements[0] == 0xEFF2) {
|
||||
ZI_WORK->unk_0x00 = '\a';
|
||||
}
|
||||
else {
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
break;
|
||||
case '\a':
|
||||
if (parameters->elements[0] == 0xEFF5) {
|
||||
ZI_WORK->unk_0x00 = '\b';
|
||||
}
|
||||
else {
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
break;
|
||||
case '\b':
|
||||
case '\t':
|
||||
if ((parameters->elements[0] == 0xEFF8) &&
|
||||
((ziU8)Zi8AlphaSignature(parameters,options->countOnly,ZI_WORK) != 0)) {
|
||||
ZI_WORK->unk_0x00 = '\t';
|
||||
candidateCount = (unsigned int)parameters->letters;
|
||||
if (options->countOnly != '\0') {
|
||||
parameters->letters = 0;
|
||||
}
|
||||
Zi8LogError(100,ZI_WORK);
|
||||
return candidateCount;
|
||||
}
|
||||
default:
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
if ((ZI_WORK->unk_0x00 == '\0') && (parameters->elements[0] == 0xEFF2)) {
|
||||
ZI_WORK->unk_0x00 = '\x01';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (1 < parameters->elementCount) {
|
||||
ZI_WORK->unk_0x00 = '\0';
|
||||
}
|
||||
}
|
||||
ZI_WORK->unk_0x18 = parameters->subLanguage;
|
||||
ZI_WORK->unk_0x16 = Zi8GetFormatVersion(1,ZI_WORK) & 2;
|
||||
options->maxCount = ZI_WORK->unk_0x10;
|
||||
options->maxWordLength = ZI_WORK->unk_0x0A;
|
||||
ZI_WORK->unk_0x0A = -1;
|
||||
if ((ziU8)Zi8LangSupported(parameters->language,ZI_WORK) == 0) {
|
||||
Zi8LogError(0x163,ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (parameters->language == 0x10) {
|
||||
error = 0x2c1;
|
||||
candidateCount = 0;
|
||||
}
|
||||
else if (parameters->language == 0x12) {
|
||||
if ((parameters->elementCount == 0) || (parameters->elements[0] >= 0xeff1)) {
|
||||
candidateCount = Zi8GetKOcandidates(parameters,options,ZI_WORK);
|
||||
}
|
||||
else {
|
||||
candidateCount = Zi8GetKoreanCandidates(parameters,options,ZI_WORK);
|
||||
}
|
||||
}
|
||||
else if ((parameters->language == 1) && ((parameters->context & 8) != 0)) {
|
||||
candidateCount = Zi8Punctuation(parameters,options,ZI_WORK);
|
||||
error = 100;
|
||||
}
|
||||
else if ((parameters->language == 1) &&
|
||||
((((parameters->getOptions & 0xbf) == 4 && (parameters->elementCount != 0)) &&
|
||||
((ziU8)Zi8IsCharacter(parameters->elements[0],ZI_WORK) != 0)))) {
|
||||
saved.convertedElementCount = Zi8GetCharInfo(parameters->elements[0],characterInfo,0x10,1,ZI_WORK);
|
||||
if (saved.convertedElementCount == 0) {
|
||||
parameters->letters = parameters->count = parameters->unk_0x20 = 0;
|
||||
candidateCount = 0;
|
||||
error = 900;
|
||||
}
|
||||
else {
|
||||
saved.lastInfoCharacter = characterInfo[saved.convertedElementCount - 1];
|
||||
if ((saved.lastInfoCharacter >= 0xf331) && (saved.lastInfoCharacter <= 0xf335)) {
|
||||
characterInfo[saved.convertedElementCount - 1] = 0xf360;
|
||||
}
|
||||
saved.savedElements = parameters->elements;
|
||||
parameters->elements = characterInfo;
|
||||
saved.savedElementCount = parameters->elementCount;
|
||||
parameters->elementCount = saved.convertedElementCount;
|
||||
saved.savedGetMode = parameters->getMode;
|
||||
parameters->getMode = 1;
|
||||
candidateCount = Zi8GetChineseCandidates(parameters,options,ZI_WORK);
|
||||
parameters->elements = saved.savedElements;
|
||||
parameters->elementCount = saved.savedElementCount;
|
||||
parameters->getMode = saved.savedGetMode;
|
||||
parameters->count = 1;
|
||||
}
|
||||
}
|
||||
else if ((parameters->language == 1) && (parameters->getMode == 0xf)) {
|
||||
error = 0x2d0;
|
||||
candidateCount = 0;
|
||||
}
|
||||
else if ((parameters->language == 1) && ((parameters->getMode == 3 || (parameters->getMode == 4)))) {
|
||||
if ((parameters->getOptions & 0x80) != 0) {
|
||||
candidateCount = Zi8Get1KeyPressSpelling(parameters,options,ZI_WORK);
|
||||
} else if (parameters->elementCount == 0) {
|
||||
candidateCount = Zi8GetChineseCandidates(parameters,options,ZI_WORK);
|
||||
} else {
|
||||
candidateCount = Zi8Get1KeyPressCandidates(parameters,options,ZI_WORK);
|
||||
}
|
||||
}
|
||||
else if ((parameters->language == 1) &&
|
||||
((((parameters->getMode == 7 || (parameters->getMode == 8)) || (parameters->getMode == 10)) || (parameters->getMode == 9)))) {
|
||||
if (ZI_WORK->unk_0x16 != '\0') {
|
||||
candidateCount = Zi8GetChineseCandidates(parameters,options,ZI_WORK);
|
||||
} else {
|
||||
error = 0x708;
|
||||
candidateCount = 0;
|
||||
}
|
||||
}
|
||||
else if ((parameters->language == 1) && ((parameters->getMode == 0xb || (parameters->getMode == 0xe)))) {
|
||||
error = 0x2ee;
|
||||
candidateCount = 0;
|
||||
}
|
||||
else if (parameters->language == 1) {
|
||||
candidateCount = Zi8GetChineseCandidates(parameters,options,ZI_WORK);
|
||||
if ((((candidateCount == 0) && ((parameters->getOptions & 0x20) == 0)) && ((parameters->getMode == 1 && (parameters->elementCount != 0))))
|
||||
&& (((parameters->elements[parameters->elementCount - 1] == 0xF37A ||
|
||||
(parameters->elements[parameters->elementCount - 1] == 0xF363)) ||
|
||||
(parameters->elements[parameters->elementCount - 1] == 0xF373)))) {
|
||||
saved.savedCharacter = parameters->elements[parameters->elementCount];
|
||||
parameters->elements[parameters->elementCount++] = 0xf368;
|
||||
candidateCount = Zi8GetChineseCandidates(parameters,options,ZI_WORK);
|
||||
parameters->elements[--parameters->elementCount] = saved.savedCharacter;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ZI_WORK->unk_0x538 = parameters->language;
|
||||
if ((parameters->getOptions & 0x80) == 0) {
|
||||
saved.restoreCandidates = 1;
|
||||
saved.savedOptions = parameters->getOptions;
|
||||
saved.savedCandidates = parameters->candidates;
|
||||
parameters->getOptions |= 0x81;
|
||||
parameters->candidates = (ziWChar*)&ZI_WORK->unk_0x338;
|
||||
options->capacity = 0x100;
|
||||
}
|
||||
if (parameters->getMode == 2) {
|
||||
if ((Zi8GetTableCount(parameters->language,0x1f,ZI_WORK) & 0x200) != 0) {
|
||||
candidateCount = Zi8GetSyllablesCandidates(parameters,options,ZI_WORK);
|
||||
} else {
|
||||
error = 0x44c;
|
||||
candidateCount = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
candidateCount = Zi8AlphaGetCandidates(parameters,options,ZI_WORK);
|
||||
}
|
||||
}
|
||||
if (saved.restoreCandidates) {
|
||||
parameters->getOptions = saved.savedOptions;
|
||||
parameters->candidates = saved.savedCandidates;
|
||||
for (outputIndex = 0; outputIndex < parameters->letters; outputIndex++) {
|
||||
parameters->candidates[outputIndex] = 0xFFF0 + outputIndex;
|
||||
}
|
||||
}
|
||||
if (error != 0) {
|
||||
Zi8LogError(error,ZI_WORK);
|
||||
}
|
||||
}
|
||||
return candidateCount;
|
||||
}
|
||||
|
||||
void Zi8InitDupWordBuf(ziPtr __zi8_work_data) {
|
||||
ZI_WORK->unk_0x539 = 0;
|
||||
}
|
||||
|
||||
ziBool Zi8IsDupWChar(ziWChar character ZI_NEED_WORK) {
|
||||
ziBool duplicate;
|
||||
ziU16* buffer;
|
||||
unsigned int index;
|
||||
duplicate = 0;
|
||||
buffer = ZI_WORK->unk_0x57A;
|
||||
if (ZI_WORK->unk_0x539 == 0) {
|
||||
buffer[0] = 2;
|
||||
buffer[1] = character;
|
||||
ZI_WORK->unk_0x539 = 1;
|
||||
Zi8LogError(0x8fd, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
for (index = ZI_WORK->unk_0x539; index != 0; index--) {
|
||||
if (character == buffer[index]) {
|
||||
duplicate = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ZI_WORK->unk_0x539++;
|
||||
buffer[(*buffer)++] = character;
|
||||
if (*buffer > 100) {
|
||||
*buffer = 2;
|
||||
buffer[1] = character;
|
||||
ZI_WORK->unk_0x539 = 1;
|
||||
}
|
||||
Zi8LogError(100, ZI_WORK);
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
ziBool Zi8IsDupWordW(ziWChar* word, ziU8 length ZI_NEED_WORK) {
|
||||
unsigned int slot;
|
||||
ziBool duplicate = 0;
|
||||
int index;
|
||||
int character;
|
||||
if (word == 0 || length == 0) {
|
||||
Zi8LogError(300, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
if (length > 20) {
|
||||
word += length - 20;
|
||||
length = 20;
|
||||
}
|
||||
for (index = 0; index < ZI_WORK->unk_0x539; index++) {
|
||||
slot = ZI_WORK->unk_0x53A[index];
|
||||
for (character = 0; character < length; character++) {
|
||||
if (word[character] != ((ziWChar (*)[21])ZI_WORK->unk_0x57A)[slot][character]) break;
|
||||
}
|
||||
if (character >= length && ((ziWChar (*)[21])ZI_WORK->unk_0x57A)[slot][character] == 0) {
|
||||
duplicate = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!duplicate) {
|
||||
if (ZI_WORK->unk_0x539 < 64) {
|
||||
slot = ZI_WORK->unk_0x53A[ZI_WORK->unk_0x539] = ZI_WORK->unk_0x539;
|
||||
ZI_WORK->unk_0x539++;
|
||||
} else {
|
||||
slot = ZI_WORK->unk_0x53A[0];
|
||||
for (index = 1; index < ZI_WORK->unk_0x539; index++) {
|
||||
ZI_WORK->unk_0x53A[index - 1] = ZI_WORK->unk_0x53A[index];
|
||||
}
|
||||
ZI_WORK->unk_0x53A[index - 1] = slot;
|
||||
}
|
||||
} else {
|
||||
slot = ZI_WORK->unk_0x53A[index];
|
||||
for (; index < ZI_WORK->unk_0x539 - 1; index++) {
|
||||
ZI_WORK->unk_0x53A[index] = ZI_WORK->unk_0x53A[index + 1];
|
||||
}
|
||||
ZI_WORK->unk_0x53A[index] = slot;
|
||||
}
|
||||
for (character = 0; character < length; character++) {
|
||||
((ziWChar (*)[21])ZI_WORK->unk_0x57A)[slot][character] = word[character];
|
||||
}
|
||||
((ziWChar (*)[21])ZI_WORK->unk_0x57A)[slot][character] = 0;
|
||||
Zi8LogError(100, ZI_WORK);
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
void Zi8Memset(ziU8* destination, ziU32 value, ziS32 count) {
|
||||
ziS32 index;
|
||||
for (index = 0; index < count; index++) destination[index] = (ziU8)value;
|
||||
}
|
||||
|
||||
void Zi8Memcpy(ziU8* destination, ziU8* source, ziS32 count) {
|
||||
ziS32 index;
|
||||
for (index = 0; index < count; index++) destination[index] = source[index];
|
||||
}
|
||||
|
||||
ziBool Zi8SetMaxWordLength(ziU8 length ZI_NEED_WORK) {
|
||||
ZI_WORK->unk_0x0A = length;
|
||||
return 1;
|
||||
}
|
||||
@@ -1,890 +0,0 @@
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zitypes.h>
|
||||
|
||||
extern ziU32 Zi8GetTableAddress(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
|
||||
|
||||
const ziU8 Zi8PinyinInitials[0x1C] = {
|
||||
0x00, 0x3C, 0x98, 0x02, 0x00, 0x38, 0x34, 0x3B, 0x00, 0x06, 0x37, 0x2B,
|
||||
0x0C, 0x26, 0x00, 0x3F, 0x09, 0x2C, 0x9A, 0x05, 0x00, 0x00, 0x11, 0x0A,
|
||||
0x0D, 0x9C, 0x00, 0x00
|
||||
};
|
||||
const ziU8 Zi8BpmfInitials[0x24] = {
|
||||
0x3C, 0x3F, 0x0C, 0x38, 0x02, 0x05, 0x26, 0x2B, 0x34, 0x37, 0x3B, 0x06,
|
||||
0x09, 0x0A, 0x1D, 0x19, 0x1B, 0x2C, 0x1C, 0x18, 0x1A, 0x01, 0x02, 0x03,
|
||||
0x05, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0D, 0x0F, 0x04, 0x00, 0x00
|
||||
};
|
||||
const ziU8 Zi8PinyinFinals[0x36][8] = {
|
||||
{0x0F, 0xFF, 0x00, 0x00, 0x3C, 0x28, 0x00, 0x00},
|
||||
{0x0F, 0x00, 0x00, 0x00, 0x3F, 0x2B, 0x00, 0x00},
|
||||
{0x0F, 0x0E, 0xFF, 0x00, 0x3F, 0x28, 0x00, 0x00},
|
||||
{0x0F, 0x0E, 0x07, 0x00, 0x3F, 0x28, 0x00, 0x00},
|
||||
{0x0F, 0x15, 0x00, 0x00, 0x3F, 0x2A, 0x00, 0x00},
|
||||
{0x09, 0xFF, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00},
|
||||
{0x09, 0x00, 0x00, 0x00, 0x3F, 0x08, 0x00, 0x00},
|
||||
{0x09, 0x01, 0xFF, 0x00, 0x38, 0x00, 0x00, 0x00},
|
||||
{0x09, 0x01, 0x00, 0x00, 0x3F, 0x04, 0x00, 0x00},
|
||||
{0x09, 0x01, 0x0F, 0x00, 0x3F, 0x01, 0x00, 0x00},
|
||||
{0x09, 0x01, 0x0E, 0xFF, 0x3E, 0x02, 0x00, 0x00},
|
||||
{0x09, 0x01, 0x0E, 0x00, 0x3F, 0x02, 0x00, 0x00},
|
||||
{0x09, 0x01, 0x0E, 0x07, 0x3F, 0x03, 0x00, 0x00},
|
||||
{0x09, 0x05, 0x00, 0x00, 0x3F, 0x09, 0x00, 0x00},
|
||||
{0x09, 0x15, 0x00, 0x00, 0x3F, 0x0B, 0x00, 0x00},
|
||||
{0x09, 0x0E, 0xFF, 0x00, 0x3E, 0x0C, 0x00, 0x00},
|
||||
{0x09, 0x0E, 0x00, 0x00, 0x3F, 0x0C, 0x00, 0x00},
|
||||
{0x09, 0x0E, 0x07, 0x00, 0x3F, 0x0D, 0x00, 0x00},
|
||||
{0x09, 0x0F, 0xFF, 0x00, 0x3E, 0x0E, 0x00, 0x00},
|
||||
{0x09, 0x0F, 0x15, 0x00, 0x3F, 0x0E, 0x00, 0x00},
|
||||
{0x09, 0x0F, 0x0E, 0xFF, 0x3F, 0x0F, 0x00, 0x00},
|
||||
{0x09, 0x0F, 0x0E, 0x07, 0x3F, 0x0F, 0x00, 0x00},
|
||||
{0x15, 0xFF, 0x00, 0x00, 0x30, 0x10, 0x00, 0x00},
|
||||
{0x15, 0x00, 0x00, 0x00, 0x3F, 0x18, 0x00, 0x00},
|
||||
{0x15, 0x01, 0xFF, 0x00, 0x38, 0x10, 0x00, 0x00},
|
||||
{0x15, 0x01, 0x00, 0x00, 0x3F, 0x17, 0x00, 0x00},
|
||||
{0x15, 0x01, 0x0E, 0xFF, 0x3E, 0x10, 0x00, 0x00},
|
||||
{0x15, 0x01, 0x0E, 0x00, 0x3F, 0x10, 0x00, 0x00},
|
||||
{0x15, 0x01, 0x0E, 0x07, 0x3F, 0x11, 0x00, 0x00},
|
||||
{0x15, 0x01, 0x09, 0x00, 0x3F, 0x13, 0x00, 0x00},
|
||||
{0x15, 0x0E, 0x00, 0x00, 0x3F, 0x1C, 0x00, 0x00},
|
||||
{0x15, 0x09, 0x00, 0x00, 0x3F, 0x1D, 0x00, 0x00},
|
||||
{0x15, 0x0F, 0x00, 0x00, 0x3F, 0x1E, 0x00, 0x00},
|
||||
{0x15, 0x05, 0x00, 0x00, 0x3F, 0x1F, 0x00, 0x00},
|
||||
{0x01, 0xFF, 0x00, 0x00, 0x38, 0x20, 0x00, 0x00},
|
||||
{0x01, 0x00, 0x00, 0x00, 0x3F, 0x23, 0x00, 0x00},
|
||||
{0x01, 0x0E, 0xFF, 0x00, 0x3E, 0x20, 0x00, 0x00},
|
||||
{0x01, 0x0E, 0x00, 0x00, 0x3F, 0x20, 0x00, 0x00},
|
||||
{0x01, 0x0E, 0x07, 0x00, 0x3F, 0x21, 0x00, 0x00},
|
||||
{0x01, 0x09, 0x00, 0x00, 0x3F, 0x25, 0x00, 0x00},
|
||||
{0x01, 0x0F, 0x00, 0x00, 0x3F, 0x26, 0x00, 0x00},
|
||||
{0x05, 0xFF, 0x00, 0x00, 0x38, 0x30, 0x00, 0x00},
|
||||
{0x05, 0x00, 0x00, 0x00, 0x3F, 0x34, 0x00, 0x00},
|
||||
{0x05, 0x0E, 0xFF, 0x00, 0x3E, 0x30, 0x00, 0x00},
|
||||
{0x05, 0x0E, 0x00, 0x00, 0x3F, 0x30, 0x00, 0x00},
|
||||
{0x05, 0x0E, 0x07, 0x00, 0x3F, 0x31, 0x00, 0x00},
|
||||
{0x05, 0x09, 0x00, 0x00, 0x3F, 0x35, 0x00, 0x00},
|
||||
{0x05, 0x12, 0x00, 0x00, 0x3F, 0x33, 0x00, 0x00},
|
||||
{0x16, 0xFF, 0x00, 0x00, 0x3C, 0x38, 0x00, 0x00},
|
||||
{0x16, 0x00, 0x00, 0x00, 0x3F, 0x38, 0x00, 0x00},
|
||||
{0x16, 0x01, 0xFF, 0x00, 0x3F, 0x39, 0x00, 0x00},
|
||||
{0x16, 0x01, 0x0E, 0x00, 0x3F, 0x39, 0x00, 0x00},
|
||||
{0x16, 0x05, 0x00, 0x00, 0x3F, 0x1F, 0x00, 0x00},
|
||||
{0x16, 0x0E, 0x00, 0x00, 0x3F, 0x3B, 0x00, 0x00}
|
||||
};
|
||||
const ziU8 nodeHeaderTable[0x20] = {
|
||||
0x00, 0x10, 0x00, 0x01, 0x00, 0x03, 0x00, 0x14, 0x00, 0x05, 0x00, 0x07,
|
||||
0x00, 0x1C, 0x00, 0x0D, 0x00, 0x0F, 0x00, 0x11, 0x00, 0x13, 0x00, 0x15,
|
||||
0x00, 0x17, 0x00, 0x1D, 0x00, 0x1F, 0x00, 0x35
|
||||
};
|
||||
|
||||
ziBool Zi8PriMatchNextChar(ziU8* node, ziU8 mask0, ziU8 value0, ziU8 mask1, ziU8 value1, ziU8 mask2, ziU8 value2, ziU8 mask3, ziU8 value3, ziU16* count, ziU8** result, ziU16* code ZI_NEED_WORK) {
|
||||
ziU16 remaining = *count;
|
||||
while (remaining-- != 0) {
|
||||
if ((value0 == (node[0] & mask0)) && (value3 == (node[3] & mask3)) && (value2 == (node[2] & mask2)) && (value1 == (node[1] & mask1))) {
|
||||
*result = node;
|
||||
*code = ((ziU16)node[6] << 8) + (ziU16)node[7];
|
||||
*count = remaining;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return 1;
|
||||
}
|
||||
node += 0xC;
|
||||
}
|
||||
Zi8LogError(0x12E, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ziBool Zi8ExactMatchNextChar(ziU8* node, ziU8 mask0, ziU8 value0, ziU8 mask1, ziU8 value1, ziU8 mask2, ziU8 value2, ziU8 mask3, ziU8 value3, ziU16* count, ziU8** result, ziU16* code ZI_NEED_WORK) {
|
||||
ziU16 remaining = *count;
|
||||
ziU8* current = node;
|
||||
while (remaining-- != 0) {
|
||||
if ((value0 == (current[0] & mask0)) && (value3 == (current[3] & mask3)) && (value2 == (current[2] & mask2)) && (value1 == (current[1] & mask1))) {
|
||||
*result = current;
|
||||
*code = ((ziU16)current[6] << 8) + (ziU16)current[7];
|
||||
*count = remaining;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return 1;
|
||||
}
|
||||
current += 0xC;
|
||||
}
|
||||
Zi8LogError(0x12E, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ziU32 Zi8SecMatchChar(ziPtr nodeAddress, ziU8* dictionaryAddress, ziMatchParam* match, ziU16* code ZI_NEED_WORK) {
|
||||
ziBool isPartial = 0;
|
||||
ziU16 matchCode;
|
||||
ziU8* data;
|
||||
ziU8 value;
|
||||
struct {
|
||||
ziU8 remaining;
|
||||
ziU8 dataIndex;
|
||||
ziU16 targetCode;
|
||||
} state;
|
||||
|
||||
if (match->field22 != 0) {
|
||||
state.targetCode = match->field22;
|
||||
matchCode = ((ziU16)(((ziU8*)nodeAddress)[4] & 3) << 8) | ((ziU8*)nodeAddress)[5];
|
||||
value = 0;
|
||||
while (value++ < 6) {
|
||||
if (state.targetCode == matchCode) {
|
||||
break;
|
||||
}
|
||||
matchCode = ((ziU16)(*(dictionaryAddress + matchCode * 8 + 6) & 3) << 8) | *(dictionaryAddress + matchCode * 8 + 7);
|
||||
if (matchCode == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (state.targetCode != matchCode) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
data = (ziU8*)Zi8GetTableAddress(1, 1, ZI_WORK);
|
||||
data += ((ziU8*)nodeAddress)[0xB] + (((ziU8*)nodeAddress)[0xA] << 8) + ((((ziU8*)nodeAddress)[9] & 0xF) << 16);
|
||||
if (ZI_WORK->unk_0x16 != 0) {
|
||||
switch (data[0] & 7) {
|
||||
case 2:
|
||||
data += 2;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
data += 3;
|
||||
break;
|
||||
case 5:
|
||||
data += 4;
|
||||
break;
|
||||
default:
|
||||
data++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
value = data[0];
|
||||
value = (value >> 4) & 7;
|
||||
if (value * 2 + 10 < match->length) {
|
||||
return 0;
|
||||
}
|
||||
if (match->length < 9) {
|
||||
if (match->length == 8) {
|
||||
if ((data[0] & 0xF) == 0xF) {
|
||||
isPartial = 1;
|
||||
}
|
||||
} else if ((match->length & 1) != 0) {
|
||||
if ((((ziU8*)nodeAddress)[match->length >> 1] & 0xF) == 0xF) {
|
||||
isPartial = 1;
|
||||
}
|
||||
} else {
|
||||
if ((((ziU8*)nodeAddress)[match->length >> 1] & 0xF0) == 0xF0) {
|
||||
isPartial = 1;
|
||||
}
|
||||
}
|
||||
if (match->length > 2) {
|
||||
if ((match->length & 1) != 0) {
|
||||
if (((((ziU8*)nodeAddress)[(match->length - 1) >> 1] & 0xF0) == 0) || ((((ziU8*)nodeAddress)[(match->length - 1) >> 1] & 0xF0) == 0xF0)) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (((((ziU8*)nodeAddress)[(match->length - 1) >> 1] & 0xF) == 0) || ((((ziU8*)nodeAddress)[(match->length - 1) >> 1] & 0xF) == 0xF)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (code != 0) {
|
||||
*code = ((ziU16)((ziU8*)nodeAddress)[6] << 8) + (ziU16)((ziU8*)nodeAddress)[7];
|
||||
}
|
||||
if (isPartial) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((match->length & 1) != 0) {
|
||||
if (((data[((match->length - 1) >> 1) - 4] & 0xF0) == 0) || ((data[((match->length - 1) >> 1) - 4] & 0xF0) == 0xF0)) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (((data[((match->length - 1) >> 1) - 4] & 0xF) == 0) || ((data[((match->length - 1) >> 1) - 4] & 0xF) == 0xF)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
state.dataIndex = 4;
|
||||
state.remaining = ((match->length + 1) >> 1) - 4;
|
||||
if (((ziU8)value + 1) < (int)state.remaining) {
|
||||
return 0;
|
||||
}
|
||||
if ((match->length & 1) != 0) {
|
||||
if ((data[(match->length >> 1) - 4] & 0xF) == 0xF) {
|
||||
isPartial = 1;
|
||||
}
|
||||
} else {
|
||||
if ((data[(match->length >> 1) - 4] & 0xF0) == 0xF0) {
|
||||
isPartial = 1;
|
||||
}
|
||||
}
|
||||
if (match->count == 0) {
|
||||
while (state.remaining != 0) {
|
||||
if ((data[0] & match->arr1[state.dataIndex]) != match->arrD[state.dataIndex]) {
|
||||
return 0;
|
||||
}
|
||||
state.dataIndex++;
|
||||
state.remaining--;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
if (code != 0) {
|
||||
*code = ((ziU16)((ziU8*)nodeAddress)[6] << 8) + (ziU16)((ziU8*)nodeAddress)[7];
|
||||
}
|
||||
if (isPartial) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
ziBool Zi8PriMatchNextComp(ziU8* node, ziU8 mask0, ziU8 value0, ziU8 mask1, ziU8 value1, ziU8 mask2, ziU8 value2, ziU8 mask3, ziU8 value3, ziU16* count, ziU8** result ZI_NEED_WORK) {
|
||||
ziU16 remaining = *count;
|
||||
while (remaining-- != 0) {
|
||||
if ((value0 == (node[0] & mask0)) && (value1 == (node[1] & mask1)) && (value2 == (node[2] & mask2)) && (value3 == (node[3] & mask3))) {
|
||||
*result = node;
|
||||
*count = remaining;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return 1;
|
||||
}
|
||||
node += 8;
|
||||
}
|
||||
Zi8LogError(0x12E, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ziBool Zi8SecMatchComp(ziPtr nodeAddress, ziMatchParam* matchAddress, ziPtr dictionaryAddress) {
|
||||
int chainIndex;
|
||||
ziU16 matchCode;
|
||||
ziU16 targetCode;
|
||||
|
||||
if (matchAddress->field22 != 0) {
|
||||
targetCode = matchAddress->field22;
|
||||
matchCode = ((ziU16)(((ziU8*)nodeAddress)[6] & 3) << 8) | ((ziU8*)nodeAddress)[7];
|
||||
chainIndex = 0;
|
||||
while (chainIndex++ < 6) {
|
||||
if (targetCode == matchCode) {
|
||||
break;
|
||||
}
|
||||
matchCode = ((ziU16)(*((ziU8*)dictionaryAddress + matchCode * 8 + 6) & 3) << 8) | *((ziU8*)dictionaryAddress + matchCode * 8 + 7);
|
||||
if (matchCode == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (targetCode != matchCode) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (matchAddress->length > 8) {
|
||||
if ((int)((ziU8*)nodeAddress)[5] < (int)(matchAddress->length - 2)) {
|
||||
return 0;
|
||||
}
|
||||
} else if ((int)((ziU8*)nodeAddress)[5] < (int)(matchAddress->length - 1)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern ziU16 Zi8MatchAltSound(ziPtr soundTable, ziU16 soundCode, ziPtr pCodeTable, ziU16 index, ziU16 mask, ziU16 value, ziU8 flag ZI_NEED_WORK);
|
||||
ziU16 Zi8GetPCode(ziU8* table, ziU8* node);
|
||||
|
||||
ziBool Zi8MatchPhonetic(ziPtr pCodeTable, ziU8* dictionary, ziPtr soundTable, ziU16 soundCode, ziU32 tableAddress, ziU8* node, ziU16* masks, ziU16* values, ziU16* count, ziU8** resultNode, ziU8** stringOffset, ziU8 partialMode, ziU8 strictMode, ziU8 numParts, ziU16 partMask, ziU16 partValue, ziU8 flag, ziU8 altMode, ziU16 initialCode, ziU16* resultCode, ziU8 lastMode ZI_NEED_WORK) {
|
||||
struct {
|
||||
ziBool hasString;
|
||||
ziU8 partIndex;
|
||||
ziU8 partCount;
|
||||
ziU8 nextCode;
|
||||
ziU8 matchedParts;
|
||||
ziU16 dictionaryIndex;
|
||||
ziU16 soundIndex;
|
||||
ziU16 remaining;
|
||||
ziU16 code;
|
||||
} traversal;
|
||||
ziU8* sound;
|
||||
typedef struct {
|
||||
ziU8 header;
|
||||
ziU8 content[11];
|
||||
} DictionaryNode;
|
||||
|
||||
if (*stringOffset != 0) {
|
||||
traversal.hasString = 1;
|
||||
} else {
|
||||
traversal.hasString = 0;
|
||||
}
|
||||
if (*count != 0) {
|
||||
traversal.remaining = *count;
|
||||
} else {
|
||||
traversal.remaining = 1;
|
||||
}
|
||||
traversal.matchedParts = 0;
|
||||
if ((lastMode != 0) && (numParts > 1)) {
|
||||
altMode = 1;
|
||||
}
|
||||
while (traversal.remaining-- != 0) {
|
||||
if ((node[0] & flag) != 0) goto decode_node;
|
||||
next_node:
|
||||
node += 0xC;
|
||||
continue;
|
||||
decode_node:
|
||||
traversal.code = Zi8GetPCode((ziU8*)pCodeTable, node);
|
||||
if ((*values != (traversal.code & *masks)) && (altMode == 0) && ((node[0] & 0x80) != 0)) {
|
||||
if (*count != 0) {
|
||||
traversal.soundIndex = (initialCode - traversal.remaining) - 1;
|
||||
} else {
|
||||
traversal.soundIndex = initialCode;
|
||||
}
|
||||
traversal.code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, traversal.soundIndex, *masks, *values, flag, ZI_WORK);
|
||||
}
|
||||
goto check_code;
|
||||
match_code:
|
||||
if (partValue == (traversal.code & partMask)) goto next_node;
|
||||
traversal.matchedParts = 1;
|
||||
if (*count != 0) {
|
||||
traversal.soundIndex = (initialCode - traversal.remaining) - 1;
|
||||
} else {
|
||||
traversal.soundIndex = initialCode;
|
||||
}
|
||||
sound = (ziU8*)(tableAddress + ((node[9] & 0xF) * 0x10000 + (node[0xB] + node[0xA] * 0x100)));
|
||||
if (ZI_WORK->unk_0x16 != 0) {
|
||||
switch (sound[0] & 7) {
|
||||
case 2:
|
||||
sound += 2;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
sound += 3;
|
||||
break;
|
||||
case 5:
|
||||
sound += 4;
|
||||
break;
|
||||
default:
|
||||
sound++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((sound[0] & 0x80) != 0) {
|
||||
sound += ((sound[0] & 0x7F) >> 4) + 1;
|
||||
} else if (numParts > 1) {
|
||||
goto next_node;
|
||||
}
|
||||
if (((ziU8)traversal.matchedParts == numParts) || (numParts == 0)) {
|
||||
*resultNode = node;
|
||||
*resultCode = ((ziU16)node[6] << 8) + node[7];
|
||||
*count = traversal.remaining;
|
||||
return 1;
|
||||
}
|
||||
next_group:
|
||||
{
|
||||
traversal.nextCode = *sound++;
|
||||
traversal.partCount = traversal.nextCode & 0xF;
|
||||
if ((traversal.nextCode & flag) == 0) {
|
||||
for (; traversal.partCount != 0; traversal.partCount--) {
|
||||
for (sound++; (*sound & 0x80) == 0; sound += 2) {
|
||||
}
|
||||
sound++;
|
||||
}
|
||||
}
|
||||
for (; traversal.partCount != 0; traversal.partCount--) {
|
||||
traversal.partIndex = 1;
|
||||
if (traversal.hasString && (sound > *stringOffset)) {
|
||||
traversal.hasString = 0;
|
||||
}
|
||||
if (!traversal.hasString) {
|
||||
*stringOffset = sound;
|
||||
}
|
||||
do {
|
||||
traversal.dictionaryIndex = sound[0] | ((ziU16)sound[1] << 8);
|
||||
sound += 2;
|
||||
if (traversal.hasString) {
|
||||
goto phonetic_skip;
|
||||
}
|
||||
traversal.code = Zi8GetPCode((ziU8*)pCodeTable, dictionary + (traversal.dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode));
|
||||
if (((traversal.code & masks[traversal.partIndex]) != values[traversal.partIndex]) && (altMode == 0) && (dictionary[(traversal.dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode)] & 0x80) != 0) {
|
||||
traversal.code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, traversal.dictionaryIndex & 0x7FFF, masks[traversal.partIndex], values[traversal.partIndex], flag, ZI_WORK);
|
||||
}
|
||||
if ((traversal.code & masks[traversal.partIndex]) == values[traversal.partIndex]) {
|
||||
goto phonetic_matched;
|
||||
}
|
||||
phonetic_skip:
|
||||
if ((traversal.dictionaryIndex & 0x8000) == 0) {
|
||||
sound++;
|
||||
while ((*sound & 0x80) == 0) {
|
||||
sound += 2;
|
||||
}
|
||||
sound++;
|
||||
}
|
||||
break;
|
||||
phonetic_matched:
|
||||
if (++traversal.partIndex == numParts) {
|
||||
if (partialMode != 0) {
|
||||
if (strictMode == 0 && (traversal.dictionaryIndex & 0x8000) != 0) goto phonetic_skip;
|
||||
if (strictMode != 0 && (traversal.dictionaryIndex & 0x8000) == 0) goto phonetic_skip;
|
||||
}
|
||||
*resultNode = node;
|
||||
*resultCode = ((ziU16)node[6] << 8) + node[7];
|
||||
*count = traversal.remaining;
|
||||
return 1;
|
||||
}
|
||||
} while ((traversal.dictionaryIndex & 0x8000) == 0);
|
||||
}
|
||||
}
|
||||
if ((traversal.nextCode & 0x80) != 0) goto next_node;
|
||||
goto next_group;
|
||||
check_code:
|
||||
if (*values == (traversal.code & *masks)) goto match_code;
|
||||
goto next_node;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ziBool Zi8GetPyFinal(ziU8* pinyin, ziU8* initial, ziU8* final);
|
||||
|
||||
ziU8 Zi8GetPyPhonetic(ziWChar* text, ziU8 count, ziU16* initial, ziU16* final, ziU8* resultCount, ziU16* bestInitial, ziU16* bestFinal ZI_NEED_WORK) {
|
||||
ziU8 pyInitial;
|
||||
ziU8 pyFinal;
|
||||
ziU8 convertedCount;
|
||||
ziU8 result;
|
||||
ziBool partial;
|
||||
ziBool alternateInitial;
|
||||
ziU8 outputIndex;
|
||||
ziU8 index;
|
||||
ziU16 value;
|
||||
ziWChar converted[256];
|
||||
ziU8 pinyin[12];
|
||||
ziWChar* current;
|
||||
|
||||
current = converted;
|
||||
alternateInitial = 0;
|
||||
result = 0;
|
||||
*resultCount = 0;
|
||||
if (count == 0) {
|
||||
Zi8LogError(0x135, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
index = 0;
|
||||
convertedCount = index;
|
||||
for (; index < count; index++) {
|
||||
if (((text[index] >= 0xF341) && (text[index] <= 0xF35A)) || ((text[index] >= 0x41) && (text[index] <= 0x5A))) {
|
||||
if ((convertedCount != 0) && (current[convertedCount - 1] != 0xF360) && (current[convertedCount - 1] != 0x27)) {
|
||||
current[convertedCount++] = 0x27;
|
||||
}
|
||||
current[convertedCount++] = (text[index] & 0xFF) + 0x20;
|
||||
} else {
|
||||
current[convertedCount++] = text[index];
|
||||
}
|
||||
}
|
||||
|
||||
count = convertedCount;
|
||||
outputIndex = 0;
|
||||
*bestInitial = 0;
|
||||
*bestFinal = 0;
|
||||
while (count != 0) {
|
||||
initial[outputIndex] = 0;
|
||||
final[outputIndex] = 0;
|
||||
value = *current;
|
||||
if (value < 0x61) {
|
||||
goto check_pinyin_extension;
|
||||
}
|
||||
if (value <= 0x7A) {
|
||||
goto pinyin_ascii;
|
||||
}
|
||||
check_pinyin_extension:
|
||||
if (value < 0xF361) {
|
||||
goto invalid_pinyin;
|
||||
}
|
||||
if (value <= 0xF37A) goto pinyin_extension;
|
||||
invalid_pinyin:
|
||||
*bestInitial = *bestFinal = initial[0] = final[0] = 0xFFFF;
|
||||
return 1;
|
||||
pinyin_extension:
|
||||
value -= 0xF361;
|
||||
goto pinyin_initial;
|
||||
pinyin_ascii:
|
||||
value -= 0x61;
|
||||
pinyin_initial:
|
||||
convertedCount = Zi8PinyinInitials[value];
|
||||
if (convertedCount != 0) {
|
||||
if (outputIndex == 0) {
|
||||
*resultCount = *resultCount + 1;
|
||||
}
|
||||
result++;
|
||||
initial[outputIndex] = 0x7E00;
|
||||
final[outputIndex] = (ziU16)(convertedCount & 0x7f) << 9;
|
||||
*bestInitial = initial[0];
|
||||
*bestFinal = final[0];
|
||||
count--;
|
||||
if (count == 0) {
|
||||
break;
|
||||
}
|
||||
current += 1;
|
||||
if ((convertedCount & 0x80) != 0) {
|
||||
if (alternateInitial) {
|
||||
initial[outputIndex] &= 0xfdff;
|
||||
final[outputIndex] &= 0xfdff;
|
||||
}
|
||||
value = *current;
|
||||
if (value != 0x68 && value != 0xF368) goto scan_final;
|
||||
if (outputIndex == 0) {
|
||||
*resultCount = *resultCount + 1;
|
||||
}
|
||||
final[outputIndex] += 0x200;
|
||||
*bestInitial = initial[0];
|
||||
*bestFinal = final[0];
|
||||
count--;
|
||||
if (count == 0) {
|
||||
break;
|
||||
}
|
||||
current += 1;
|
||||
}
|
||||
} else if ((*current == 0xF369) || (*current == 0x69)) {
|
||||
goto invalid_pinyin;
|
||||
}
|
||||
scan_final:
|
||||
partial = 0;
|
||||
for (index = 0; index < 4; index++) {
|
||||
pinyin[index] = 0;
|
||||
}
|
||||
index = 0;
|
||||
while (index < 4) {
|
||||
value = *current;
|
||||
if ((value == 0x27) || (value == 0xF360) || (value == 0x20)) {
|
||||
if (index != 0) {
|
||||
partial = 1;
|
||||
}
|
||||
goto finish_final;
|
||||
}
|
||||
if ((value >= 0xF331) && (value < 0xF336)) {
|
||||
if (index != 0) {
|
||||
partial = 1;
|
||||
}
|
||||
goto finish_final;
|
||||
}
|
||||
if ((value < 0x61) || (value > 0x7A)) {
|
||||
if (value < 0xF361) {
|
||||
goto finish_final;
|
||||
}
|
||||
value -= 0xF361;
|
||||
if (value > 0x19) {
|
||||
if (outputIndex == 0) {
|
||||
*resultCount = *resultCount + 1;
|
||||
}
|
||||
goto finish_final;
|
||||
}
|
||||
} else {
|
||||
value -= 0x61;
|
||||
}
|
||||
pinyin[index] = (ziU8)value + 1;
|
||||
if (Zi8GetPyFinal(pinyin, &pyInitial, &pyFinal) == 0) goto try_final_extension;
|
||||
if (outputIndex == 0) {
|
||||
*resultCount = *resultCount + 1;
|
||||
}
|
||||
current++;
|
||||
index++;
|
||||
count--;
|
||||
if (count == 0) {
|
||||
goto finish_final;
|
||||
}
|
||||
continue;
|
||||
try_final_extension:
|
||||
|
||||
if (index < 3) {
|
||||
pinyin[index + 1] = 0xFF;
|
||||
if (Zi8GetPyFinal(pinyin, &pyInitial, &pyFinal) != 0) {
|
||||
if (outputIndex == 0) {
|
||||
*resultCount = *resultCount + 1;
|
||||
}
|
||||
pinyin[index + 1] = 0;
|
||||
current++;
|
||||
index++;
|
||||
count--;
|
||||
if (count == 0) break;
|
||||
} else {
|
||||
pinyin[index + 1] = 0;
|
||||
pinyin[index] = 0;
|
||||
partial = 1;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
pinyin[index] = 0;
|
||||
partial = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
finish_final:
|
||||
if ((index > 3) && (count != 0) && (((value = *current) == 0x27) || (value == 0xF360) || (value == 0x20))) {
|
||||
if (outputIndex == 0) {
|
||||
*resultCount = *resultCount + 1;
|
||||
}
|
||||
current++;
|
||||
count--;
|
||||
}
|
||||
if (index > 3) {
|
||||
partial = 1;
|
||||
}
|
||||
if (partial && alternateInitial == 0) {
|
||||
if (Zi8GetPyFinal(pinyin, &pyInitial, &pyFinal) != 0) {
|
||||
if (convertedCount == 0) {
|
||||
result++;
|
||||
initial[outputIndex] = 0x7E00;
|
||||
final[outputIndex] = 0x200;
|
||||
}
|
||||
initial[outputIndex] |= (ziU16)pyInitial << 3;
|
||||
final[outputIndex] |= (ziU16)pyFinal << 3;
|
||||
*bestInitial = initial[0];
|
||||
*bestFinal = final[0];
|
||||
} else {
|
||||
if ((index != 0) && (count != 0)) {
|
||||
goto invalid_pinyin;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pinyin[index] = 0xFF;
|
||||
if (Zi8GetPyFinal(pinyin, &pyInitial, &pyFinal) != 0) {
|
||||
if (convertedCount == 0) {
|
||||
result++;
|
||||
initial[outputIndex] = 0x7E00;
|
||||
final[outputIndex] = 0x200;
|
||||
}
|
||||
initial[outputIndex] |= (ziU16)pyInitial << 3;
|
||||
final[outputIndex] |= (ziU16)pyFinal << 3;
|
||||
*bestInitial = initial[0];
|
||||
*bestFinal = final[0];
|
||||
if ((outputIndex == 0) && (count == 0)) {
|
||||
pinyin[index] = 0;
|
||||
if (Zi8GetPyFinal(pinyin, &pyInitial, &pyFinal) != 0) {
|
||||
if (convertedCount == 0) {
|
||||
*bestInitial = 0x7E00;
|
||||
*bestFinal = 0x200;
|
||||
}
|
||||
*bestInitial |= (ziU16)pyInitial << 3;
|
||||
*bestFinal |= (ziU16)pyFinal << 3;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pinyin[index] = 0;
|
||||
if (Zi8GetPyFinal(pinyin, &pyInitial, &pyFinal) != 0) {
|
||||
if (convertedCount == 0) {
|
||||
result++;
|
||||
initial[outputIndex] = 0x7E00;
|
||||
final[outputIndex] = 0x200;
|
||||
}
|
||||
initial[outputIndex] |= (ziU16)pyInitial << 3;
|
||||
final[outputIndex] |= (ziU16)pyFinal << 3;
|
||||
*bestInitial = initial[0];
|
||||
*bestFinal = final[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count != 0) {
|
||||
value = *current;
|
||||
if ((value == 0x27) || (value == 0xF360) || (value == 0x20)) {
|
||||
current++;
|
||||
count--;
|
||||
if (outputIndex == 0) {
|
||||
*resultCount = *resultCount + 1;
|
||||
}
|
||||
} else if ((value >= 0xF331) && ((value -= 0xF331) <= 4)) {
|
||||
value++;
|
||||
initial[outputIndex] |= 7;
|
||||
final[outputIndex] |= value;
|
||||
*bestInitial = initial[0];
|
||||
*bestFinal = final[0];
|
||||
count--;
|
||||
current++;
|
||||
if (outputIndex == 0) {
|
||||
*resultCount = *resultCount + 1;
|
||||
}
|
||||
if ((count != 0) && (((value = *current) == 0x27) || (value == 0xF360) || (value == 0x20))) {
|
||||
count--;
|
||||
current++;
|
||||
if (outputIndex == 0) {
|
||||
*resultCount = *resultCount + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
outputIndex++;
|
||||
if (outputIndex > 0xf) break;
|
||||
}
|
||||
if ((result > 1) && (text[*resultCount - 1] >= 0xF341) && (text[*resultCount - 1] <= 0xF35A)) {
|
||||
*resultCount = *resultCount - 1;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
ziBool Zi8GetPyFinal(ziU8* pinyin, ziU8* initial, ziU8* final) {
|
||||
ziU8 index = 0;
|
||||
ziU8 row;
|
||||
row = 0;
|
||||
goto check_row;
|
||||
scan_row:
|
||||
while (index < 4) {
|
||||
if (pinyin[index] != Zi8PinyinFinals[row][index]) {
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if (index < 4) {
|
||||
goto next_row;
|
||||
}
|
||||
*initial = Zi8PinyinFinals[row][4];
|
||||
*final = Zi8PinyinFinals[row][5];
|
||||
return 1;
|
||||
next_row:
|
||||
row++;
|
||||
index = 0;
|
||||
check_row:
|
||||
if (row < 0x36) {
|
||||
goto scan_row;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ziS32 Zi8GetBpmfPhonetic(ziWChar* text, ziU8 count, ziU16* initial, ziU16* final, ziU16* bestInitial, ziU16* bestFinal ZI_NEED_WORK) {
|
||||
ziU16 value;
|
||||
ziU32 resultCount = 0;
|
||||
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
if (count == 0) {
|
||||
Zi8ReplaceLastError(0x135, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
value = text[0];
|
||||
if (value < 0xF305) {
|
||||
Zi8ReplaceLastError(0x154, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
value -= 0xF305;
|
||||
if (value >= 0x25) {
|
||||
Zi8ReplaceLastError(0x154, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
if (value < 0x15) {
|
||||
*initial = 0x7E00;
|
||||
*final = ((ziU16)Zi8BpmfInitials[value] & 0x7F) << 9;
|
||||
resultCount++;
|
||||
count--;
|
||||
if (count == 0) {
|
||||
*bestInitial = *initial;
|
||||
*bestFinal = *final;
|
||||
if ((value >= 0xE) && (value <= 0x14)) {
|
||||
*bestInitial |= 0x1F8;
|
||||
*bestFinal |= 0x38;
|
||||
}
|
||||
return resultCount;
|
||||
}
|
||||
text++;
|
||||
if (*text == 0xF360) {
|
||||
resultCount++;
|
||||
count--;
|
||||
if (count == 0) {
|
||||
return resultCount;
|
||||
}
|
||||
Zi8ReplaceLastError(0x156, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
*initial = 0x7E00;
|
||||
*final = 0x200;
|
||||
}
|
||||
|
||||
value = *text - 0xF305;
|
||||
switch ((ziS32)value) {
|
||||
case 0x22:
|
||||
goto bpmf_value_22;
|
||||
case 0x23:
|
||||
goto bpmf_value_23;
|
||||
case 0x24:
|
||||
goto bpmf_value_24;
|
||||
default:
|
||||
goto set_bpmf_initial;
|
||||
}
|
||||
bpmf_value_22:
|
||||
*final |= 0x80;
|
||||
*initial |= 0x180;
|
||||
resultCount++;
|
||||
count--;
|
||||
if (count == 0) {
|
||||
*bestInitial = *initial | 0x78;
|
||||
*bestFinal = *final | 0x38;
|
||||
return resultCount;
|
||||
}
|
||||
text++;
|
||||
goto after_bpmf_initial;
|
||||
bpmf_value_23:
|
||||
*final |= 0x100;
|
||||
*initial |= 0x180;
|
||||
resultCount++;
|
||||
count--;
|
||||
if (count == 0) {
|
||||
*bestInitial = *initial | 0x78;
|
||||
*bestFinal = *final | 0x38;
|
||||
return resultCount;
|
||||
}
|
||||
text++;
|
||||
goto after_bpmf_initial;
|
||||
bpmf_value_24:
|
||||
*final |= 0x180;
|
||||
*initial |= 0x180;
|
||||
resultCount++;
|
||||
count--;
|
||||
if (count == 0) {
|
||||
*bestInitial = *initial | 0x78;
|
||||
*bestFinal = *final | 0x38;
|
||||
return resultCount;
|
||||
}
|
||||
text++;
|
||||
goto after_bpmf_initial;
|
||||
set_bpmf_initial:
|
||||
if ((*text < 0xF331) || (*text > 0xF335)) {
|
||||
*initial |= 0x180;
|
||||
}
|
||||
after_bpmf_initial:
|
||||
|
||||
value = *text - 0xF305;
|
||||
if ((value > 0x14) && (value < 0x22)) {
|
||||
*final |= (ziU16)Zi8BpmfInitials[value] << 3;
|
||||
*initial |= 0x78;
|
||||
resultCount++;
|
||||
count--;
|
||||
if (count == 0) {
|
||||
*bestInitial = *initial;
|
||||
*bestFinal = *final;
|
||||
return resultCount;
|
||||
}
|
||||
text++;
|
||||
} else if ((*text < 0xF331) || (*text > 0xF335) || ((*initial & 0x180) == 0x180)) {
|
||||
*final |= 0x38;
|
||||
*initial |= 0x78;
|
||||
}
|
||||
|
||||
value = *text;
|
||||
if (value < 0xF331) {
|
||||
Zi8ReplaceLastError(0x155, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
value -= 0xF330;
|
||||
if (value > 5) {
|
||||
Zi8ReplaceLastError(0x155, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
*initial |= 7;
|
||||
*final |= value;
|
||||
*bestInitial = *initial;
|
||||
*bestFinal = *final;
|
||||
resultCount++;
|
||||
count--;
|
||||
if (count != 0) {
|
||||
Zi8ReplaceLastError(0x157, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
return resultCount;
|
||||
}
|
||||
|
||||
ziU16 Zi8GetPCode(ziU8* table, ziU8* node) {
|
||||
ziU16 index = ((ziU16)node[8] << 2) | (((ziU16)node[9] & 0x80) >> 6);
|
||||
return ((((ziU16)node[9] >> 4) & 7) | (ziU16)table[index] | ((ziU16)table[index + 1] << 8));
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
#include <stddef.h>
|
||||
#include <zi8clib/zitypes.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zconvert.h>
|
||||
#include <zi8clib/zmtkey.h>
|
||||
|
||||
typedef struct ziPudSection {
|
||||
ziU8 flags;
|
||||
ziU8 language;
|
||||
ziU8 offset[2];
|
||||
ziU8 count[2];
|
||||
ziU8 reserved[2];
|
||||
} ziPudSection;
|
||||
typedef struct ziPudHeader {
|
||||
ziU8 format[3];
|
||||
ziU8 languageCount;
|
||||
ziU8 options[4];
|
||||
ziPudSection sections[1];
|
||||
} ziPudHeader;
|
||||
ziU32 Zi8_8147FD7C(ziWChar*, ziU8, ziU8, ziWChar*, ziU16, ziU8, ziU8 ZI_NEED_WORK);
|
||||
|
||||
ziU32 ZiIsPhoneticChar(ziWChar character) {
|
||||
if ((character < 0xF305 || character > 0xF329) && (character < 0xF361 || character > 0xF37A)) return 0;
|
||||
return 1;
|
||||
}
|
||||
int ZiGetZHWordSize(ziWChar* word, int size) {
|
||||
int bytes;
|
||||
ziWChar* cursor;
|
||||
bytes = 0;
|
||||
for (bytes = 0; bytes < size;) {
|
||||
cursor = word;
|
||||
if (ZiIsPhoneticChar(*cursor)) return bytes;
|
||||
bytes += 2;
|
||||
word++;
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
void Zi8CopyZHSpelling(ziU8* source, ziWChar* output, ziU16 capacity, int size, int start) {
|
||||
int offset;
|
||||
ziU8* cursor;
|
||||
if (output != 0 && capacity != 0) {
|
||||
*output = 0;
|
||||
if (size > start) {
|
||||
for (offset = 0; offset < size - start && offset < (int)((ziU32)capacity << 1); offset += 2) {
|
||||
cursor = source + start + offset;
|
||||
*output++ = *(ziWChar*)cursor;
|
||||
}
|
||||
*output = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
ziU8 ZADP_Zi8SetPDremoveOpt(ziU8 option ZI_NEED_WORK) {
|
||||
ziU8 previous;
|
||||
previous = ZI_WORK->pdRemoveOpt;
|
||||
ZI_WORK->pdRemoveOpt = option;
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return previous;
|
||||
}
|
||||
ziU32 Zi8MatchPUDdata_ZHS(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* output, ziU16 capacity, ziWChar* spelling, ziU16 spellingCapacity, ziU8 complete, ziU8 continuation ZI_NEED_WORK) {
|
||||
ziWChar folded;
|
||||
ziU32 entrySize, wordSize, copied;
|
||||
ziU8* entry;
|
||||
ziU8* word;
|
||||
int index;
|
||||
int fallback = 0;
|
||||
ziPudHeader* table;
|
||||
ziPudSection* section;
|
||||
if (!(ZI_WORK->pudCount <= 16 && ZI_WORK->pudCount != 0 && ZI_WORK->pudTable[ZI_WORK->pudCount - 1] != 0)) {
|
||||
Zi8LogError(0x4B0, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
if (language == 1) {
|
||||
length &= 0x7F;
|
||||
length *= 2;
|
||||
}
|
||||
if (continuation == 0) {
|
||||
table = (ziPudHeader*)ZI_WORK->pudTable[ZI_WORK->pudCount - 1];
|
||||
index = 0;
|
||||
section = table->sections;
|
||||
while (index < table->languageCount && section->language != language) {
|
||||
index++;
|
||||
section++;
|
||||
}
|
||||
if (table->languageCount <= index) {
|
||||
Zi8LogError(0x4F6, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
ZI_WORK->unk_0x314 = section->count[0] * 0x100 + section->count[1];
|
||||
ZI_WORK->unk_0x310 = (ziU32)table + section->offset[0] * 0x100 + section->offset[1];
|
||||
ZI_WORK->unk_0x318 = 0;
|
||||
}
|
||||
for (;;) {
|
||||
entry = (ziU8*)ZI_WORK->unk_0x310;
|
||||
if (entry == 0) {
|
||||
Zi8LogError(0x4B3, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
while ((ziS32)ZI_WORK->unk_0x318 < (ziS32)ZI_WORK->unk_0x314) {
|
||||
word = entry + 1;
|
||||
wordSize = *entry;
|
||||
entrySize = wordSize;
|
||||
if (language == 1) {
|
||||
if (*word < ZI_WORK->unk_0x17) goto next;
|
||||
entrySize = wordSize - 1;
|
||||
word = entry + 2;
|
||||
wordSize = ZiGetZHWordSize((ziWChar*)word, entrySize);
|
||||
} else if (ZI_WORK->unk_0x31E != 0 && complete != 0 && wordSize > length && word[length] == 0x20) goto matchText;
|
||||
if ((ziS32)length > (ziS32)wordSize || (complete != 0 && wordSize != length) || (complete == 0 && wordSize == length)) goto next;
|
||||
if (language == 1) {
|
||||
for (index = 0; index < length; index++) {
|
||||
if (word[index] != ((ziU8*)pattern)[index]) goto next;
|
||||
}
|
||||
goto matched;
|
||||
}
|
||||
matchText:
|
||||
for (index = 0; index < length; index++) {
|
||||
if (pattern[index] < 0xEFF1 || pattern[index] > 0xF37F) {
|
||||
folded = Zi8ConvertUC2WC(word[index], language, __zi8_work_data);
|
||||
if (folded != pattern[index] && (!ZI_WORK->unk_0x1F || !Zi8ChangeCharCase(0, &folded, language, __zi8_work_data) || folded != pattern[index])) goto next;
|
||||
} else if (pattern[index] != Zi8ConvertUC2Key(word[index], language, __zi8_work_data)) goto next;
|
||||
}
|
||||
matched:
|
||||
if (fallback) {
|
||||
ZI_WORK->unk_0x310 = 0;
|
||||
ZI_WORK->unk_0x318 = 0;
|
||||
ZI_WORK->unk_0x314 = 0;
|
||||
if (*pattern < 0xEFF1) *output = Zi8ConvertWC2Key(*pattern, language, __zi8_work_data);
|
||||
else *output = *pattern;
|
||||
return 1;
|
||||
}
|
||||
if (language == 1) {
|
||||
index = 0;
|
||||
for (copied = 0; index < (ziS32)wordSize && copied < capacity; copied++) {
|
||||
((ziU8*)output)[index] = word[index];
|
||||
((ziU8*)output)[index + 1] = word[index + 1];
|
||||
index += 2;
|
||||
}
|
||||
Zi8CopyZHSpelling(word, spelling, spellingCapacity, entrySize, wordSize);
|
||||
} else {
|
||||
for (copied = 0; copied < wordSize && copied < capacity; copied++) {
|
||||
output[copied] = Zi8ConvertUC2WC(word[copied], language, __zi8_work_data);
|
||||
if (ZI_WORK->unk_0x31E != 0 && copied >= length && output[copied] == 0x20) {
|
||||
if (complete != 0 || copied >= length) break;
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
}
|
||||
ZI_WORK->unk_0x318++;
|
||||
ZI_WORK->unk_0x310 = (ziU32)(word + entrySize);
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return (ziU8)copied;
|
||||
next:
|
||||
ZI_WORK->unk_0x318++;
|
||||
entry = word + entrySize;
|
||||
}
|
||||
if (length != 1 || complete == 0 || continuation != 0) {
|
||||
ZI_WORK->unk_0x310 = 0;
|
||||
ZI_WORK->unk_0x318 = 0;
|
||||
ZI_WORK->unk_0x314 = 0;
|
||||
return 0;
|
||||
}
|
||||
complete = 0;
|
||||
fallback = 1;
|
||||
ZI_WORK->unk_0x318 = 0;
|
||||
}
|
||||
}
|
||||
ziU32 Zi8MatchPUDdata(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* output, ziU16 capacity, ziU8 complete, ziU8 continuation ZI_NEED_WORK) {
|
||||
ziU32 result;
|
||||
if (continuation == 0) ZI_WORK->pudCount = 1;
|
||||
for (;;) {
|
||||
result = Zi8_8147FD7C(pattern, length, language, output, capacity, complete, continuation, __zi8_work_data);
|
||||
if ((ziU8)result != 0) break;
|
||||
if (++ZI_WORK->pudCount <= 16) {
|
||||
continuation = 0;
|
||||
} else {
|
||||
ZI_WORK->pudCount = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
ziU32 Zi8_8147FD7C(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* output, ziU16 capacity, ziU8 complete, ziU8 continuation ZI_NEED_WORK) {
|
||||
return Zi8MatchPUDdata_ZHS(pattern, length, language, output, capacity, 0, 0, complete, continuation, __zi8_work_data);
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zconvert.h>
|
||||
#include <zi8clib/zmtkey.h>
|
||||
|
||||
typedef struct ziUserWord {
|
||||
ziU8 size, language, length, priority;
|
||||
ziU8 text[1];
|
||||
} ziUserWord;
|
||||
typedef struct ziUserDictionary {
|
||||
ziU16 flags, end, current, boundary;
|
||||
ziU8 entries[1];
|
||||
} ziUserDictionary;
|
||||
void Zi8Memset(ziPtr, ziU32, ziU32);
|
||||
|
||||
ziBool Zi8_81480224(ziUserWord* word ZI_NEED_WORK) {
|
||||
ziU8 length;
|
||||
ziU8 position;
|
||||
ziUwdNode* previous;
|
||||
ziUwdNode* current;
|
||||
ziUwdNode* added;
|
||||
ziUserWord* candidate;
|
||||
if (ZI_WORK->uwdCount >= 32) {
|
||||
Zi8LogError(0x19D, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
if (word == 0) {
|
||||
Zi8LogError(0x19F, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
length = word->length;
|
||||
if (length == 0) {
|
||||
Zi8LogError(0x193, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
if (length > 63) {
|
||||
Zi8LogError(0x194, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
previous = 0;
|
||||
current = ZI_WORK->uwdList;
|
||||
while (current != 0) {
|
||||
candidate = (ziUserWord*)current->word;
|
||||
if (ZI_WORK->unk_0x12E == 1 && word->priority > candidate->priority) break;
|
||||
if (candidate->length == length) {
|
||||
position = 0;
|
||||
while (position < length) {
|
||||
if (candidate->text[position] != word->text[position]) break;
|
||||
position++;
|
||||
}
|
||||
if (position == length) {
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
previous = current;
|
||||
current = current->next;
|
||||
}
|
||||
length = ZI_WORK->uwdCount++;
|
||||
added = &ZI_WORK->uwdNodes[length];
|
||||
if (previous == 0) {
|
||||
ZI_WORK->uwdList = added;
|
||||
added->next = current;
|
||||
} else {
|
||||
previous->next = added;
|
||||
added->next = current;
|
||||
}
|
||||
added->word = (ziU8*)word;
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return 1;
|
||||
}
|
||||
ziUserWord* Zi8_814803F4(ziPtr __zi8_work_data) {
|
||||
ziUserWord* word;
|
||||
if (ZI_WORK->uwdCount != 0) {
|
||||
ZI_WORK->uwdCount--;
|
||||
word = (ziUserWord*)ZI_WORK->uwdList->word;
|
||||
ZI_WORK->uwdList = ZI_WORK->uwdList->next;
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return word;
|
||||
}
|
||||
Zi8LogError(0x19E, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
void Zi8_8148047C(ziPtr __zi8_work_data) {
|
||||
Zi8Memset(ZI_WORK->uwdNodes, 0, sizeof(ZI_WORK->uwdNodes));
|
||||
ZI_WORK->uwdCount = 0;
|
||||
ZI_WORK->uwdList = 0;
|
||||
}
|
||||
ziU8 Zi8MatchUWDdata(ziWChar* pattern, ziU8 length, ziWChar* currentWord, ziU16 currentLength, ziU8 language, ziWChar* output, ziU16 capacity, ziU8 complete, ziU8 continuation ZI_NEED_WORK) {
|
||||
ziWChar folded;
|
||||
int fallback = 0;
|
||||
int visited = 0;
|
||||
int prefixLength;
|
||||
int position, previousOffset;
|
||||
ziU32 size;
|
||||
ziU8 entryLanguage;
|
||||
ziU32 entryLength;
|
||||
ziU8* cursor;
|
||||
ziU8* begin;
|
||||
ziU8* boundary;
|
||||
ziU8* end;
|
||||
ziUserWord* candidate;
|
||||
ziUserWord* previous;
|
||||
ziUserWord* result;
|
||||
ziUserDictionary* dictionary;
|
||||
int firstSegment;
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
if (!(ZI_WORK->unk_0x138 <= 2 && ZI_WORK->unk_0x138 != 0 && ZI_WORK->unk_0x130[ZI_WORK->unk_0x138 - 1] != 0)) {
|
||||
Zi8ReplaceLastError(0x19C, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
dictionary = ZI_WORK->unk_0x130[ZI_WORK->unk_0x138 - 1];
|
||||
if (continuation != 0) {
|
||||
result = Zi8_814803F4(__zi8_work_data);
|
||||
entryLength = 0;
|
||||
if (result != 0) {
|
||||
entryLanguage = result->language;
|
||||
entryLength = result->length;
|
||||
if (entryLength >= capacity) {
|
||||
Zi8_8148047C(__zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
for (position = 0; position < (ziS32)entryLength; position++) output[position] = Zi8ConvertUC2WC(result->text[position], entryLanguage, __zi8_work_data);
|
||||
}
|
||||
return entryLength;
|
||||
}
|
||||
{
|
||||
Zi8_8148047C(__zi8_work_data);
|
||||
ZI_WORK->unk_0x13C = 0;
|
||||
if (currentWord == 0 || currentLength == 0 || currentWord[currentLength - 1] != 0x20) ZI_WORK->unk_0x140 = 0;
|
||||
else {
|
||||
prefixLength = 0;
|
||||
for (position = currentLength - 2; currentWord[position] != 0x20 && position >= 0; position--) prefixLength++;
|
||||
position++;
|
||||
if (prefixLength == 0 || prefixLength > 63) ZI_WORK->unk_0x140 = 0;
|
||||
else {
|
||||
ZI_WORK->unk_0x140 = 1;
|
||||
ZI_WORK->unk_0x141[0] = prefixLength + 5;
|
||||
ZI_WORK->unk_0x141[prefixLength + 4] = prefixLength + 5;
|
||||
ZI_WORK->unk_0x141[1] = language;
|
||||
ZI_WORK->unk_0x141[2] = prefixLength;
|
||||
previousOffset = 4;
|
||||
for (; prefixLength > 0; prefixLength--, position++) {
|
||||
folded = currentWord[position];
|
||||
ZI_WORK->unk_0x141[previousOffset] = Zi8ConvertWC2UC(folded, language, __zi8_work_data);
|
||||
ZI_WORK->unk_0x184[previousOffset] = 0;
|
||||
if (ZI_WORK->unk_0x1F != 0) {
|
||||
if (!Zi8ChangeCharCase(1, &folded, language, __zi8_work_data)) Zi8ChangeCharCase(0, &folded, language, __zi8_work_data);
|
||||
ZI_WORK->unk_0x184[previousOffset] = Zi8ConvertWC2UC(folded, language, __zi8_work_data);
|
||||
}
|
||||
if (ZI_WORK->unk_0x141[previousOffset++] == 0) {
|
||||
ZI_WORK->unk_0x140 = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ZI_WORK->unk_0x140 == 0 && length == 0) return 0;
|
||||
rescan:
|
||||
begin = dictionary->entries + dictionary->current;
|
||||
boundary = (ziU8*)dictionary + dictionary->boundary + 7;
|
||||
end = (ziU8*)dictionary + dictionary->end + 7;
|
||||
cursor = begin;
|
||||
if (begin < boundary) firstSegment = 1;
|
||||
else firstSegment = 0;
|
||||
while (firstSegment ? cursor < boundary : cursor < end) {
|
||||
size = *cursor;
|
||||
candidate = (ziUserWord*)cursor;
|
||||
position = visited++;
|
||||
if ((ziS32)ZI_WORK->unk_0x13C <= position && (size & 0xC0) == 0) {
|
||||
previous = (ziUserWord*)(cursor + size);
|
||||
if ((ziU8*)previous > end) previous = (ziUserWord*)(cursor + ((ziU8*)dictionary - end) + 7);
|
||||
entryLanguage = candidate->language;
|
||||
entryLength = candidate->length;
|
||||
if (entryLanguage == language && length <= entryLength && entryLength < capacity && (complete == 0 || entryLength == length) && (complete != 0 || entryLength != length)) {
|
||||
for (position = 0; position < length; position++) {
|
||||
if (pattern[position] < 0xEFF1 || pattern[position] > 0xF010) {
|
||||
folded = Zi8ConvertUC2WC(candidate->text[position], language, __zi8_work_data);
|
||||
if (folded != pattern[position] && (!ZI_WORK->unk_0x1F || !Zi8ChangeCharCase(0, &folded, language, __zi8_work_data) || folded != pattern[position])) goto next;
|
||||
} else if (pattern[position] != Zi8ConvertUC2Key(candidate->text[position], language, __zi8_work_data)) goto next;
|
||||
}
|
||||
if (ZI_WORK->unk_0x140 != 0) {
|
||||
if (ZI_WORK->unk_0x141[0] != previous->size || ZI_WORK->unk_0x141[1] != previous->language || ZI_WORK->unk_0x141[2] != previous->length) goto next;
|
||||
for (position = 4; position < ZI_WORK->unk_0x141[2] + 4; position++) {
|
||||
if (ZI_WORK->unk_0x141[position] != ((ziU8*)previous)[position] && ZI_WORK->unk_0x184[position] != ((ziU8*)previous)[position]) goto next;
|
||||
}
|
||||
}
|
||||
Zi8_81480224(candidate, __zi8_work_data);
|
||||
}
|
||||
}
|
||||
next:
|
||||
cursor += size;
|
||||
if (end < cursor) {
|
||||
if (firstSegment) break;
|
||||
firstSegment = 1;
|
||||
cursor = dictionary->entries + (cursor - end - 1);
|
||||
}
|
||||
}
|
||||
if (ZI_WORK->unk_0x140 != 0 && length != 0) {
|
||||
ZI_WORK->unk_0x140 = 0;
|
||||
visited = 0;
|
||||
goto rescan;
|
||||
}
|
||||
if (complete == 1 && length != 0 && continuation == 0) {
|
||||
complete = 0;
|
||||
fallback = 1;
|
||||
visited = 0;
|
||||
goto rescan;
|
||||
}
|
||||
}
|
||||
result = Zi8_814803F4(__zi8_work_data);
|
||||
entryLength = 0;
|
||||
if (result != 0) {
|
||||
entryLanguage = result->language;
|
||||
entryLength = result->length;
|
||||
if (entryLength >= capacity) {
|
||||
Zi8_8148047C(__zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
for (position = 0; position < (ziS32)entryLength; position++) output[position] = Zi8ConvertUC2WC(result->text[position], entryLanguage, __zi8_work_data);
|
||||
}
|
||||
return entryLength;
|
||||
}
|
||||
@@ -1,215 +0,0 @@
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zitypes.h>
|
||||
|
||||
extern ziU16 nodeHeaderTable[16];
|
||||
|
||||
ziU32 ZiDAWGGetChild(ziU32 node) {
|
||||
ziU32 base;
|
||||
ziU16 header;
|
||||
ziS32 offset;
|
||||
|
||||
base = node;
|
||||
header = nodeHeaderTable[*(ziU8*)node >> 4];
|
||||
if (((ziU32)header & 1) == 0) {
|
||||
node = 0;
|
||||
} else {
|
||||
if ((*(ziU8*)node & 0xf) == 0xf) {
|
||||
offset = 2;
|
||||
} else {
|
||||
offset = 1;
|
||||
}
|
||||
|
||||
node += offset;
|
||||
if (((ziU32)header & 2) != 0) {
|
||||
if ((*(ziU8*)node & 0x80) != 0) {
|
||||
offset = (*(ziU8*)node & 0x7f) * 0x10000 + ((ziU32)*((ziU8*)node + 1) & 0xffff) * 0x100 + 0x8000;
|
||||
offset += *((ziU8*)node + 2);
|
||||
} else {
|
||||
offset = ((ziU32)*(ziU8*)node & 0xffff) * 0x100;
|
||||
offset += (ziU32)*((ziU8*)node + 1);
|
||||
}
|
||||
} else if (((ziU32)header & 8) != 0) {
|
||||
if ((*(ziU8*)node & 0x80) != 0) {
|
||||
offset += 3;
|
||||
} else {
|
||||
offset += 2;
|
||||
}
|
||||
}
|
||||
|
||||
node = base + offset;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
ziU8* ZiDAWGGetSibling(ziU8* node) {
|
||||
ziU16 header;
|
||||
ziU8* cursor = node;
|
||||
ziS32 depth;
|
||||
ziS32 offset;
|
||||
|
||||
depth = 0;
|
||||
offset = 0;
|
||||
header = nodeHeaderTable[node[0] >> 4];
|
||||
if ((header & 4) == 0) {
|
||||
node = 0;
|
||||
} else {
|
||||
if ((header & 8) != 0) {
|
||||
if ((node[0] & 0xf) == 0xf) {
|
||||
node += 2;
|
||||
} else {
|
||||
node += 1;
|
||||
}
|
||||
|
||||
if ((header & 2) != 0) {
|
||||
if ((*node & 0x80) == 0) {
|
||||
node += 2;
|
||||
} else {
|
||||
node += 3;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*node & 0x80) != 0) {
|
||||
node += (*node & 0x7f) * 0x10000 + (ziU32)node[1] * 0x100 +
|
||||
(ziU32)node[2] + 0x8000;
|
||||
} else {
|
||||
node += (ziU16)*node * 0x100 + (ziU32)node[1];
|
||||
}
|
||||
} else {
|
||||
cursor = node;
|
||||
do {
|
||||
header = nodeHeaderTable[cursor[0] >> 4];
|
||||
if ((cursor[0] & 0xf) == 0xf) {
|
||||
cursor += 2;
|
||||
offset += 2;
|
||||
} else {
|
||||
cursor++;
|
||||
offset++;
|
||||
}
|
||||
|
||||
if ((header & 1) != 0) {
|
||||
if ((header & 2) == 0) {
|
||||
depth++;
|
||||
} else if ((*cursor & 0x80) != 0) {
|
||||
cursor += 3;
|
||||
offset += 3;
|
||||
} else {
|
||||
cursor += 2;
|
||||
offset += 2;
|
||||
}
|
||||
}
|
||||
|
||||
if ((header & 4) == 0) {
|
||||
depth--;
|
||||
} else if ((header & 8) != 0) {
|
||||
if ((*cursor & 0x80) != 0) {
|
||||
cursor += 3;
|
||||
offset += 3;
|
||||
} else {
|
||||
cursor += 2;
|
||||
offset += 2;
|
||||
}
|
||||
depth--;
|
||||
}
|
||||
} while (0 < depth);
|
||||
|
||||
node += offset;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
ziU8 ZiDAWGgetEOWattribute(ziU32 node) {
|
||||
return (nodeHeaderTable[*(ziU8*)node >> 4] & 0x10) > 0;
|
||||
}
|
||||
|
||||
ziU32 ZiDAWGgetCHARattribute(ziPtr context, ziU32 node, ziPtr __zi8_work_data) {
|
||||
ziU8 key;
|
||||
ziU32 attribute;
|
||||
|
||||
if ((*(ziU8*)node & 0xf) == 0xf) {
|
||||
key = (ziU32)*((ziU8*)node + 1) + 0xf;
|
||||
} else {
|
||||
key = (ziU32)*(ziU8*)node & 0xf;
|
||||
}
|
||||
|
||||
if (key > ((zi8DawgCtx*)context)->cap) {
|
||||
Zi8LogError(0x138b, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
attribute = key << 24;
|
||||
attribute |= ((ziU8*)((zi8DawgCtx*)context)->p0C)[key] << 16;
|
||||
attribute += ((ziU32)((ziU8*)((zi8DawgCtx*)context)->p08)[key * 2] & 0xFFFF) << 8;
|
||||
attribute += ((ziU8*)((zi8DawgCtx*)context)->p08)[key * 2 + 1];
|
||||
Zi8LogError(0x64, __zi8_work_data);
|
||||
return attribute;
|
||||
}
|
||||
|
||||
ziU32 ZiDAWGGetGraph(ziPtr context) {
|
||||
return (((ziU32)((zi8DawgCtx*)context)->table[2] & 0xFFFF) << 8) +
|
||||
((zi8DawgCtx*)context)->table[3] +
|
||||
((ziU32)((zi8DawgCtx*)context)->table + 4);
|
||||
}
|
||||
|
||||
ziU32 ZiDAWGGetGraphInfo(zi8DawgCtx* context, ziU8* entry, ziU16* keys) {
|
||||
ziU32 graph;
|
||||
ziS32 result;
|
||||
ziU32 end;
|
||||
ziU8 depth;
|
||||
ziU32 pair;
|
||||
|
||||
graph = ZiDAWGGetGraph(context);
|
||||
result = 0;
|
||||
pair = (((ziU16)entry[0] << 8) + entry[1]);
|
||||
if (pair != 0) {
|
||||
return 0;
|
||||
}
|
||||
pair = (((ziU16)entry[2] << 8) + entry[3]);
|
||||
if (pair == 0) {
|
||||
end = (ziU32)(entry + (((ziU16)entry[4] << 8) + entry[5] + 1) * 10);
|
||||
entry += 10;
|
||||
depth = 0;
|
||||
while ((depth < 2) && (*keys != 0)) {
|
||||
if ((*keys < 0xeff1) || (0xf010 < *keys)) {
|
||||
break;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
if (*keys == (ziS32)(entry[3] + ((ziU16)entry[2] << 8))) {
|
||||
break;
|
||||
}
|
||||
entry += (entry[1] + ((ziU16)entry[0] << 8)) * 10 + 10;
|
||||
if (((ziU32)entry >= end) ||
|
||||
(*keys == (ziS32)(entry[3] + ((ziU16)entry[2] << 8)))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((ziU32)entry >= end) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
result = graph + (ziU32)entry[4] * 0x10000 + ((ziU16)entry[5] << 8) +
|
||||
entry[6];
|
||||
((zi8DawgCtx*)context)->unk_0x338 =
|
||||
graph + (ziU32)entry[7] * 0x10000 + ((ziU16)entry[8] << 8) +
|
||||
entry[9];
|
||||
if (((zi8DawgCtx*)context)->unk_0x338 == graph) {
|
||||
((zi8DawgCtx*)context)->unk_0x338 = 0;
|
||||
}
|
||||
|
||||
if ((entry[1] + ((ziU16)entry[0] << 8)) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
end = (ziU32)(entry + (entry[1] + ((ziU16)entry[0] << 8)) * 10 + 10);
|
||||
entry += 10;
|
||||
depth++;
|
||||
keys++;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1,419 +0,0 @@
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zitypes.h>
|
||||
|
||||
ziU32 Zi8GetTableAddress(ziU8 lang, ziU8 tableIdx, ziPtr workData);
|
||||
ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx, ziPtr workData);
|
||||
|
||||
ziU8 Zi8_814813FC(ziWChar character, ziU8* result, ziU16* index, ziPtr workData) {
|
||||
ziU16 i;
|
||||
ziU8* table;
|
||||
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 5, workData);
|
||||
i = 0;
|
||||
while (table[i] != 0) {
|
||||
if (character == table[i]) {
|
||||
*index = i;
|
||||
*result = table[i];
|
||||
Zi8LogError(0x64, workData);
|
||||
return 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
Zi8LogError(0x2A8, workData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ziU8 Zi8_81481E6C(ziU16* resultIndex, ziU16* input, ziU8 type, ziU16 count, ziPtr workData);
|
||||
|
||||
ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
|
||||
ziPtr workData) {
|
||||
struct {
|
||||
ziU8 characterIndex;
|
||||
ziU8 matched;
|
||||
ziU8 elementIndex;
|
||||
ziU16 index;
|
||||
ziU16 currentCandidate;
|
||||
ziU16 inputIndex;
|
||||
ziU16 nextIndex;
|
||||
ziU16 tableCount31;
|
||||
ziU16 tableCount6;
|
||||
ziU16 tableCount3;
|
||||
ziU16 tableCount0;
|
||||
ziU8* table31;
|
||||
ziU8* table2;
|
||||
ziU8* table1;
|
||||
} state;
|
||||
ziU16 buffer[100];
|
||||
ziU8 result;
|
||||
ziU16 currentCharacter;
|
||||
ziU8* selectedTable;
|
||||
|
||||
state.nextIndex = 0;
|
||||
result = 0;
|
||||
state.characterIndex = 0xFF;
|
||||
state.currentCandidate = params->firstCandidate;
|
||||
params->letters = params->count = params->unk_0x20 = 0;
|
||||
if ((argument != 0) && (*argument != 0)) {
|
||||
Zi8LogError(0x7D0, workData);
|
||||
return 0;
|
||||
}
|
||||
if ((params->elementCount == 0) || (params->elementCount > 100)) {
|
||||
Zi8LogError(0x64, workData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 4, workData);
|
||||
state.table1 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 1, workData);
|
||||
state.table2 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 2, workData);
|
||||
state.table31 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x31, workData);
|
||||
state.tableCount0 = Zi8GetTableCount(ZI8_LANG_KO, 0, workData);
|
||||
state.tableCount3 = Zi8GetTableCount(ZI8_LANG_KO, 3, workData);
|
||||
state.tableCount6 = Zi8GetTableCount(ZI8_LANG_KO, 6, workData);
|
||||
state.tableCount31 = Zi8GetTableCount(ZI8_LANG_KO, 0x31, workData);
|
||||
|
||||
for (state.elementIndex = 0; state.elementIndex < params->elementCount;
|
||||
state.elementIndex++) {
|
||||
currentCharacter = params->elements[state.elementIndex];
|
||||
|
||||
if ((currentCharacter >= 0x61) && (currentCharacter <= 0x7A)) {
|
||||
buffer[state.elementIndex] = state.table1[(currentCharacter - 0x61) * 2];
|
||||
} else if ((currentCharacter >= 0x41) && (currentCharacter <= 0x5A)) {
|
||||
buffer[state.elementIndex] = (state.table1 + (currentCharacter - 0x41) * 2)[1];
|
||||
} else {
|
||||
state.matched = 0;
|
||||
for (; state.table2[state.matched * 3] != 0; state.matched++) {
|
||||
if (currentCharacter == state.table2[state.matched * 3]) break;
|
||||
}
|
||||
if (state.table2[state.matched * 3] != 0) {
|
||||
buffer[state.elementIndex] =
|
||||
((ziU16)(state.table2 + state.matched * 3)[1] << 8) |
|
||||
(state.table2 + state.matched * 3)[2];
|
||||
} else {
|
||||
Zi8LogError(0x161, workData);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = 0;
|
||||
for (currentCharacter = 0; currentCharacter < state.elementIndex; currentCharacter++) {
|
||||
if (Zi8_814813FC(buffer[currentCharacter], &state.characterIndex,
|
||||
&state.inputIndex, workData) != 0) {
|
||||
state.matched = Zi8_81481E6C(&state.nextIndex,
|
||||
buffer + currentCharacter + 1,
|
||||
state.characterIndex,
|
||||
(state.elementIndex - currentCharacter) - 1,
|
||||
workData);
|
||||
if ((((struct __zi8_work_data_s*)workData)->unk_0x1B30 == 1)) {
|
||||
switch (state.characterIndex) {
|
||||
case 1:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x1E, workData);
|
||||
break;
|
||||
case 2:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x1F, workData);
|
||||
break;
|
||||
case 4:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x20, workData);
|
||||
break;
|
||||
case 7:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x21, workData);
|
||||
break;
|
||||
case 8:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x22, workData);
|
||||
break;
|
||||
case 9:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x23, workData);
|
||||
break;
|
||||
case 0x11:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x24, workData);
|
||||
break;
|
||||
case 0x12:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x25, workData);
|
||||
break;
|
||||
case 0x13:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x26, workData);
|
||||
break;
|
||||
case 0x15:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x27, workData);
|
||||
break;
|
||||
case 0x16:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x28, workData);
|
||||
break;
|
||||
case 0x17:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x29, workData);
|
||||
break;
|
||||
case 0x18:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x2A, workData);
|
||||
break;
|
||||
case 0x19:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x2B, workData);
|
||||
break;
|
||||
case 0x1A:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x2C, workData);
|
||||
break;
|
||||
case 0x1B:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x2D, workData);
|
||||
break;
|
||||
case 0x1C:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x2E, workData);
|
||||
break;
|
||||
case 0x1D:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x2F, workData);
|
||||
break;
|
||||
case 0x1E:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x30, workData);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
state.matched = 0;
|
||||
}
|
||||
if (state.matched != 0) {
|
||||
if (state.tableCount6 == 0) {
|
||||
state.nextIndex += state.inputIndex * state.tableCount3;
|
||||
}
|
||||
if (state.currentCandidate != 0) {
|
||||
state.currentCandidate--;
|
||||
} else {
|
||||
params->candidates[(ziU8)result] =
|
||||
((ziU16)selectedTable[state.nextIndex * 2] << 8) | (selectedTable + state.nextIndex * 2)[1];
|
||||
if ((state.tableCount6 != 0) && (((struct __zi8_work_data_s*)workData)->unk_0x1B30 == 0)) {
|
||||
params->candidates[(ziU8)result] += state.inputIndex * state.tableCount3;
|
||||
}
|
||||
result++;
|
||||
}
|
||||
if (currentCharacter == 0) {
|
||||
params->count = state.matched + 1;
|
||||
}
|
||||
currentCharacter += state.matched;
|
||||
} else {
|
||||
if (state.currentCandidate != 0) {
|
||||
state.index = 0;
|
||||
for (; state.index < state.tableCount31; state.index++) {
|
||||
if (state.table31[state.index * 3] == buffer[currentCharacter] &&
|
||||
(state.table31 + state.index * 3)[1] == buffer[currentCharacter + 1]) break;
|
||||
}
|
||||
if (state.index == state.tableCount31) {
|
||||
state.currentCandidate--;
|
||||
}
|
||||
if (currentCharacter == 0) {
|
||||
params->count = 1;
|
||||
}
|
||||
} else {
|
||||
for (state.index = 0; state.index < state.tableCount31; state.index++) {
|
||||
if ((state.table31[(state.index * 3)] == buffer[currentCharacter]) &&
|
||||
((state.table31 + state.index * 3)[1] == buffer[currentCharacter + 1])) {
|
||||
if (currentCharacter == 0) {
|
||||
params->count = 1;
|
||||
}
|
||||
params->candidates[(ziU8)result] =
|
||||
state.tableCount0 + (state.table31 + state.index * 3)[2];
|
||||
result++;
|
||||
currentCharacter++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (state.index == state.tableCount31) {
|
||||
if ((params->candidates[(ziU8)result] = buffer[currentCharacter]) < 0xFF) {
|
||||
if (currentCharacter == 0) {
|
||||
params->count = 1;
|
||||
}
|
||||
params->candidates[(ziU8)result] += state.tableCount0;
|
||||
result++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result >= params->maxCandidates) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
params->letters = result;
|
||||
Zi8LogError(0x64, workData);
|
||||
return result;
|
||||
}
|
||||
|
||||
ziU8 Zi8_81481E6C(ziU16* resultIndex, ziU16* input, ziU8 type, ziU16 count, ziPtr workData) {
|
||||
ziU16 nestedScratch;
|
||||
ziU16 nestedIndexStorage;
|
||||
ziU16 index1;
|
||||
ziU16 index2;
|
||||
ziU16 index3;
|
||||
ziU16 index4;
|
||||
ziU16 firstCharacter;
|
||||
ziU16 tableCount;
|
||||
ziU8 mappedCharacter;
|
||||
ziU8* table;
|
||||
|
||||
firstCharacter = input[0];
|
||||
mappedCharacter = 0xFF;
|
||||
if (((struct __zi8_work_data_s*)workData)->unk_0x1B30 == 0) {
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 3, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 3, workData);
|
||||
} else {
|
||||
switch (type) {
|
||||
case 1:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0xB, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0xB, workData);
|
||||
break;
|
||||
case 2:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0xC, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0xC, workData);
|
||||
break;
|
||||
case 4:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0xD, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0xD, workData);
|
||||
break;
|
||||
case 7:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0xE, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0xE, workData);
|
||||
break;
|
||||
case 8:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0xF, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0xF, workData);
|
||||
break;
|
||||
case 9:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x10, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x10, workData);
|
||||
break;
|
||||
case 0x11:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x11, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x11, workData);
|
||||
break;
|
||||
case 0x12:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x12, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x12, workData);
|
||||
break;
|
||||
case 0x13:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x13, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x13, workData);
|
||||
break;
|
||||
case 0x15:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x14, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x14, workData);
|
||||
break;
|
||||
case 0x16:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x15, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x15, workData);
|
||||
break;
|
||||
case 0x17:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x16, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x16, workData);
|
||||
break;
|
||||
case 0x18:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x17, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x17, workData);
|
||||
break;
|
||||
case 0x19:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x18, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x18, workData);
|
||||
break;
|
||||
case 0x1A:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x19, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x19, workData);
|
||||
break;
|
||||
case 0x1B:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x1A, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x1A, workData);
|
||||
break;
|
||||
case 0x1C:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x1B, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x1B, workData);
|
||||
break;
|
||||
case 0x1D:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x1C, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x1C, workData);
|
||||
break;
|
||||
case 0x1E:
|
||||
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x1D, workData);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 0x1D, workData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
*resultIndex = 0;
|
||||
if ((count < 1) || (firstCharacter >= 0xFF)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
index1 = *resultIndex;
|
||||
for (; index1 < tableCount; index1++) {
|
||||
if (table[index1 * 4] >= firstCharacter) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((index1 >= tableCount) || (firstCharacter != table[index1 * 4])) {
|
||||
return 0;
|
||||
}
|
||||
if ((count < 2) || ((firstCharacter = input[1]) >= 0xFF)) {
|
||||
*resultIndex = index1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
index2 = index1;
|
||||
for (; index2 < tableCount; index2++) {
|
||||
if ((table + index2 * 4)[1] >= firstCharacter) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((index2 >= tableCount) || (firstCharacter != (table + index2 * 4)[1]) ||
|
||||
(input[0] != table[index2 * 4])) {
|
||||
*resultIndex = index1;
|
||||
return 1;
|
||||
}
|
||||
if ((count < 3) || ((firstCharacter = input[2]) >= 0xFF)) {
|
||||
*resultIndex = index2;
|
||||
return 2;
|
||||
}
|
||||
|
||||
index3 = index2;
|
||||
for (; index3 < tableCount; index3++) {
|
||||
if ((table + index3 * 4)[2] >= firstCharacter) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((index3 >= tableCount) || (firstCharacter != (table + index3 * 4)[2]) ||
|
||||
(input[1] != (table + index3 * 4)[1]) || (input[0] != table[index3 * 4])) {
|
||||
if ((Zi8_814813FC(input[1], &mappedCharacter, &nestedScratch, workData) != 0) &&
|
||||
(Zi8_81481E6C(&nestedIndexStorage, input + 2, mappedCharacter, 1, workData) != 0)) {
|
||||
*resultIndex = index1;
|
||||
return 1;
|
||||
}
|
||||
*resultIndex = index2;
|
||||
return 2;
|
||||
}
|
||||
if ((count < 4) || ((firstCharacter = input[3]) >= 0xFF)) {
|
||||
*resultIndex = index3;
|
||||
return 3;
|
||||
}
|
||||
|
||||
index4 = index3;
|
||||
for (; index4 < tableCount; index4++) {
|
||||
if ((table + index4 * 4)[3] >= firstCharacter) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((index4 >= tableCount) || (firstCharacter != (table + index4 * 4)[3]) ||
|
||||
(input[2] != (table + index4 * 4)[2]) || (input[1] != (table + index4 * 4)[1]) ||
|
||||
(input[0] != table[index4 * 4])) {
|
||||
if ((Zi8_814813FC(input[2], &mappedCharacter, &nestedScratch, workData) != 0) &&
|
||||
(Zi8_81481E6C(&nestedIndexStorage, input + 3, mappedCharacter, 1, workData) != 0)) {
|
||||
*resultIndex = index2;
|
||||
return 2;
|
||||
}
|
||||
*resultIndex = index3;
|
||||
return 3;
|
||||
}
|
||||
if ((count < 5) || ((firstCharacter = input[4]) >= 0xFF)) {
|
||||
*resultIndex = index4;
|
||||
return 4;
|
||||
}
|
||||
if ((Zi8_814813FC(input[3], &mappedCharacter, &nestedScratch, workData) != 0) &&
|
||||
(Zi8_81481E6C(&nestedIndexStorage, input + 4, mappedCharacter, 1, workData) != 0)) {
|
||||
*resultIndex = index3;
|
||||
return 3;
|
||||
}
|
||||
*resultIndex = index4;
|
||||
return 4;
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
#include <stddef.h>
|
||||
#include <zi8clib/zitypes.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
|
||||
typedef struct ziSearchState {
|
||||
ziU32 flags;
|
||||
ziWChar* word;
|
||||
ziU32 length;
|
||||
ziU32 position;
|
||||
ziU32 capacity;
|
||||
ziU32 options;
|
||||
} ziSearchState;
|
||||
typedef struct ziUserKeys {
|
||||
ziWChar* upper[32];
|
||||
ziWChar* lower[32];
|
||||
} ziUserKeys;
|
||||
typedef struct ziChineseEntry {
|
||||
ziU8 data[9];
|
||||
ziU8 offsetHigh;
|
||||
ziU8 offsetLow[2];
|
||||
} ziChineseEntry;
|
||||
|
||||
ziU8 Zi8GetCandidatesOrCount(ziGetParam*, ziSearchState* ZI_NEED_WORK);
|
||||
ziU8 Zi8GetFormatVersion(ziU8 ZI_NEED_WORK);
|
||||
ziPtr Zi8GetTableAddress(ziU8, ziU8 ZI_NEED_WORK);
|
||||
ziU16 Zi8Uni2Ord(ziWChar ZI_NEED_WORK);
|
||||
|
||||
ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK) {
|
||||
int count;
|
||||
int offset;
|
||||
ziU8 group;
|
||||
ziU8 remaining;
|
||||
ziU16 value;
|
||||
ziWChar* cursor;
|
||||
ziSearchState search;
|
||||
ziGetParam request;
|
||||
ziWChar ordinals[65];
|
||||
int length;
|
||||
int unmatched;
|
||||
ziChineseEntry* entry;
|
||||
ziU8* data;
|
||||
ziU8 formats[8] = {1, 5, 0, 0, 0, 0, 0, 0};
|
||||
ziU32 savedFormats = ZI_WORK->unk_0x1410;
|
||||
ziU8 savedCount = ZI_WORK->unk_0x1418;
|
||||
search.flags = 0;
|
||||
search.word = 0;
|
||||
search.length = 0;
|
||||
search.position = 0;
|
||||
search.capacity = 0;
|
||||
search.options = 0;
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
if (word == 0 || *word == 0) {
|
||||
Zi8ReplaceLastError(300, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
if (language != 1) {
|
||||
for (length = 0; word[length] != 0; length++) {
|
||||
if (word[length] >= 0xEFF1 || length == 64) return 0;
|
||||
}
|
||||
((ziU8*)&search.length)[0] = length;
|
||||
((ziU8*)&search.flags)[2] = 1;
|
||||
((ziU16*)&search.capacity)[0] = 64;
|
||||
search.word = word;
|
||||
request.language = language;
|
||||
request.getMode = 0;
|
||||
request.subLanguage = 7;
|
||||
request.context = 1;
|
||||
request.getOptions = 0x81;
|
||||
request.elements = word;
|
||||
request.elementCount = length;
|
||||
request.currentWord = 0;
|
||||
request.wordCharCount = 0;
|
||||
request.candidates = ordinals;
|
||||
request.maxCandidates = 1;
|
||||
request.firstCandidate = 0;
|
||||
ZI_WORK->unk_0x1410 = (ziU32)formats;
|
||||
if (ZI_WORK->unk_0x1C[0] == 2) {
|
||||
ZI_WORK->unk_0x1418 = 0;
|
||||
if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->unk_0x1418++] = 1;
|
||||
if (ZI_WORK->unk_0x09 & 4) formats[ZI_WORK->unk_0x1418++] = 2;
|
||||
if (ZI_WORK->unk_0x09 & 2) formats[ZI_WORK->unk_0x1418++] = 3;
|
||||
if (ZI_WORK->unk_0x09 & 8) formats[ZI_WORK->unk_0x1418++] = 4;
|
||||
if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->unk_0x1418++] = 5;
|
||||
if (ZI_WORK->unk_0x09 & 4) formats[ZI_WORK->unk_0x1418++] = 6;
|
||||
if (ZI_WORK->unk_0x09 & 2) formats[ZI_WORK->unk_0x1418++] = 7;
|
||||
if (ZI_WORK->unk_0x09 & 8) formats[ZI_WORK->unk_0x1418++] = 8;
|
||||
} else if (ZI_WORK->unk_0x1C[0] == 0) ZI_WORK->unk_0x1418 = 1;
|
||||
else ZI_WORK->unk_0x1418 = 2;
|
||||
count = Zi8GetCandidatesOrCount(&request, &search, __zi8_work_data);
|
||||
ZI_WORK->unk_0x1410 = savedFormats;
|
||||
ZI_WORK->unk_0x1418 = savedCount;
|
||||
if (count != 0) return 1;
|
||||
}
|
||||
if (language == 1) {
|
||||
length = 0;
|
||||
do {
|
||||
ordinals[length] = Zi8Uni2Ord(word[length], __zi8_work_data);
|
||||
if (ordinals[length] == 0xFFFF) return 0;
|
||||
length++;
|
||||
if (length == 64) return 0;
|
||||
} while (word[length] != 0);
|
||||
{
|
||||
if (length == 1) return 1;
|
||||
count = --length;
|
||||
ordinals[count] |= 0x8000;
|
||||
ZI_WORK->unk_0x16 = Zi8GetFormatVersion(1, __zi8_work_data) & 2;
|
||||
entry = (ziChineseEntry*)Zi8GetTableAddress(1, 0, __zi8_work_data) + ordinals[0];
|
||||
data = (ziU8*)Zi8GetTableAddress(1, 1, __zi8_work_data) + ((entry->offsetHigh & 15) << 16 | ((entry->offsetLow[0] << 8) | entry->offsetLow[1]));
|
||||
if (ZI_WORK->unk_0x16 != 0) {
|
||||
switch (*data & 7) {
|
||||
case 2:
|
||||
offset = 2;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
offset = 3;
|
||||
break;
|
||||
case 5:
|
||||
offset = 4;
|
||||
break;
|
||||
default:
|
||||
offset = 1;
|
||||
break;
|
||||
}
|
||||
data += offset;
|
||||
}
|
||||
if ((*data & 0x80) == 0) return 0;
|
||||
group = 0;
|
||||
data += ((*data & 0x7F) >> 4) + 1;
|
||||
while ((group & 0x80) == 0) {
|
||||
group = *data++;
|
||||
for (remaining = group & 15; remaining != 0; remaining--) {
|
||||
unmatched = count;
|
||||
cursor = ordinals;
|
||||
while (unmatched > 0) {
|
||||
value = data[0] | (data[1] << 8);
|
||||
data += 2;
|
||||
cursor++;
|
||||
if (value != *cursor) break;
|
||||
unmatched--;
|
||||
if (value & 0x8000) break;
|
||||
}
|
||||
if (unmatched == 0) return 1;
|
||||
if (!(value & 0x8000)) {
|
||||
data++;
|
||||
while (!(*data & 0x80)) data += 2;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Zi8LogError(0x2BD, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
} else Zi8ReplaceLastError(0x26C, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
ziWChar Zi8ConvertUC2UserKey(ziChar character, ziU8 language ZI_NEED_WORK) {
|
||||
ziUserKeys* keys;
|
||||
ziU16 key;
|
||||
ziWChar* cursor;
|
||||
if (character == 0 || language > 0x82 || (keys = ZI_WORK->userKeys[language]) == 0) return 0;
|
||||
for (key = 0; key < 32; key++) {
|
||||
for (cursor = keys->lower[key]; cursor != 0 && *cursor != 0; cursor++) {
|
||||
if ((ziU16)*cursor == (ziU16)character) goto found;
|
||||
}
|
||||
for (cursor = keys->upper[key]; cursor != 0 && *cursor != 0; cursor++) {
|
||||
if ((ziU16)*cursor == (ziU16)character) goto found;
|
||||
}
|
||||
}
|
||||
found:
|
||||
if (key >= 32) return 0;
|
||||
if (key == 0) return 0xEFFA;
|
||||
if (key >= 1 && key <= 9) return key + 0xEFF0;
|
||||
if (key <= 31) return key + 0xEFF1;
|
||||
return 0;
|
||||
}
|
||||
@@ -3,14 +3,6 @@
|
||||
extern ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
|
||||
extern ziU32 Zi8GetTableAddress(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
|
||||
|
||||
typedef struct {
|
||||
ziU8 keyBytes[5];
|
||||
ziU8 childHigh;
|
||||
ziU8 childLow;
|
||||
ziU8 characterHigh;
|
||||
ziU8 characterLow;
|
||||
} ZiKoreanKeyEntry;
|
||||
|
||||
ziU32 Zi8_8148302C(ziU16 key, ziU8* table ZI_NEED_WORK) {
|
||||
ziU32 value;
|
||||
ziU16 count;
|
||||
@@ -20,7 +12,7 @@ ziU32 Zi8_8148302C(ziU16 key, ziU8* table ZI_NEED_WORK) {
|
||||
for (i = 0; (ziU16)i < count; i++) {
|
||||
value = (ziU16)(((ziU16)table[((i & 0xFFFF) << 3) + (i & 0xFFFF) + 7] << 8) |
|
||||
table[((i & 0xFFFF) << 3) + (i & 0xFFFF) + 8]);
|
||||
if (value == key) {
|
||||
if (key == value) {
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return i;
|
||||
}
|
||||
@@ -99,7 +91,7 @@ ziU32 Zi8_81483308(ziGetParam* param, ziU16 key, ziU8* count ZI_NEED_WORK) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ziU32 Zi8_814833F0(const ziGetParam* param, ziU16 key ZI_NEED_WORK) {
|
||||
ziBool Zi8_814833F0(const ziGetParam* param, ziU16 key ZI_NEED_WORK) {
|
||||
ziU8 i;
|
||||
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
@@ -119,28 +111,23 @@ ziU32 Zi8_814833F0(const ziGetParam* param, ziU16 key ZI_NEED_WORK) {
|
||||
|
||||
ziU32 Zi8_814834AC(ziGetParam* param, ziU16* remaining, ziU8* count,
|
||||
ziU8* inserted ZI_NEED_WORK) {
|
||||
struct {
|
||||
ziBool matches;
|
||||
ziU8 candidateIndex;
|
||||
ziU16 tableCount;
|
||||
ziS32 compactIndex;
|
||||
ZiKoreanKeyEntry* entry;
|
||||
ziU8* tableB;
|
||||
ziU8* tableA;
|
||||
union {
|
||||
ziU32 firstWord;
|
||||
ziU8 bytes[5];
|
||||
} keys;
|
||||
} filter;
|
||||
ziBool matches;
|
||||
ziS32 entry;
|
||||
ziS32 tableA;
|
||||
ziS32 tableB;
|
||||
ziU16 tableCount;
|
||||
ziU8 matched;
|
||||
ziU32 j;
|
||||
ziS32 i;
|
||||
ziS32 candidate;
|
||||
ziU8 matched;
|
||||
ziU8 candidateIndex;
|
||||
union {
|
||||
ziU32 words[13];
|
||||
ziU8 bytes[52];
|
||||
} local;
|
||||
|
||||
j = 0;
|
||||
filter.candidateIndex = 0;
|
||||
matched = 0;
|
||||
filter.keys.bytes[4] = filter.keys.firstWord = 0;
|
||||
local.words[0] = 0;
|
||||
local.bytes[4] = 0;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
if (param->elementCount == 0) {
|
||||
if (*remaining >= *count) {
|
||||
@@ -154,354 +141,394 @@ ziU32 Zi8_814834AC(ziGetParam* param, ziU16* remaining, ziU8* count,
|
||||
Zi8_81483308(param, param->candidates[i], inserted, ZI_WORK);
|
||||
}
|
||||
for (i = 0; i < ((ziS32)*count - (ziS32)*remaining); i++) {
|
||||
param->candidates[i] = param->candidates[*remaining + i];
|
||||
param->candidates[i] = param->candidates[(ziU32)*remaining + i];
|
||||
}
|
||||
*count -= *remaining;
|
||||
*count = *count - (ziU8)*remaining;
|
||||
*remaining = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (param->elementCount > 9) {
|
||||
*count = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
filter.tableA = (ziU8*)Zi8GetTableAddress(param->language, 9, ZI_WORK);
|
||||
filter.tableB = (ziU8*)Zi8GetTableAddress(param->language, 10, ZI_WORK);
|
||||
if (filter.tableA == 0) {
|
||||
} else if (param->elementCount <= 9) {
|
||||
tableA = Zi8GetTableAddress(param->language, 9, ZI_WORK);
|
||||
tableB = Zi8GetTableAddress(param->language, 10, ZI_WORK);
|
||||
if (tableA == 0) {
|
||||
Zi8ReplaceLastError(0x76C, ZI_WORK);
|
||||
return 0;
|
||||
} else if (filter.tableB == 0) {
|
||||
} else if (tableB == 0) {
|
||||
Zi8ReplaceLastError(0x776, ZI_WORK);
|
||||
return 0;
|
||||
} else {
|
||||
filter.tableCount = Zi8GetTableCount(ZI8_LANG_KO, 9, ZI_WORK);
|
||||
Zi8_81483118(param, filter.keys.bytes);
|
||||
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 9, ZI_WORK);
|
||||
Zi8_81483118(param, local.bytes);
|
||||
i = 0;
|
||||
while (i < filter.tableCount && matched < *count) {
|
||||
filter.matches = ZI8_TRUE;
|
||||
filter.entry = (ZiKoreanKeyEntry*)&filter.tableA[(i << 3) + i];
|
||||
while (i < tableCount && matched < *count) {
|
||||
matches = ZI8_TRUE;
|
||||
entry = (i << 3) + tableA + i;
|
||||
j = 0;
|
||||
if (param->elementCount > 1) {
|
||||
for (j = 0; (int)(j & 0xFF) < (int)param->elementCount / 2; j++) {
|
||||
if (filter.keys.bytes[j & 0xFF] != filter.entry->keyBytes[j & 0xFF]) {
|
||||
filter.matches = ZI8_FALSE;
|
||||
for (j = 0; (j & 0xFF) < (ziU32)(param->elementCount >> 1); j++) {
|
||||
if (local.bytes[j & 0xFF] != *((ziU8*)entry + (j & 0xFF))) {
|
||||
matches = ZI8_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (filter.matches && (param->elementCount % 2) != 0 &&
|
||||
((filter.keys.bytes[j & 0xFF] & 0xF0) != (filter.entry->keyBytes[j & 0xFF] & 0xF0))) {
|
||||
filter.matches = ZI8_FALSE;
|
||||
if (matches && (param->elementCount & 1) != 0 &&
|
||||
((local.bytes[j & 0xFF] & 0xF0) != (*((ziU8*)entry + (j & 0xFF)) & 0xF0))) {
|
||||
matches = ZI8_FALSE;
|
||||
}
|
||||
if (filter.matches) {
|
||||
for (filter.candidateIndex = 0; filter.candidateIndex < *count; filter.candidateIndex++) {
|
||||
if (param->candidates[filter.candidateIndex] ==
|
||||
(((ziU16)((ZiKoreanKeyEntry*)filter.tableA)[i].characterHigh << 8) | (ziU16)((ZiKoreanKeyEntry*)filter.tableA)[i].characterLow)) {
|
||||
if (matches) {
|
||||
for (candidateIndex = 0; candidateIndex < *count; candidateIndex++) {
|
||||
if (param->candidates[candidateIndex] ==
|
||||
(ziU16)((*((ziU8*)entry + 7) << 8) | *((ziU8*)entry + 8))) {
|
||||
matched++;
|
||||
param->candidates[filter.candidateIndex] &= 0x7FFF;
|
||||
param->candidates[candidateIndex] =
|
||||
param->candidates[candidateIndex] & 0x7FFF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (matched >= *remaining) {
|
||||
if ((ziU16)matched >= *remaining) {
|
||||
matched = *count;
|
||||
*count = 0;
|
||||
for (candidate = 0; candidate < matched; candidate++) {
|
||||
if ((param->candidates[candidate] & 0x8000) == 0) {
|
||||
param->candidates[candidate] |= 0x8000;
|
||||
if (*remaining != 0) {
|
||||
--*remaining;
|
||||
Zi8_81483308(param, param->candidates[candidate], inserted, ZI_WORK);
|
||||
} else {
|
||||
if (*count != candidate) {
|
||||
param->candidates[*count] = param->candidates[candidate];
|
||||
for (i = 0; i < matched; i++) {
|
||||
if ((param->candidates[i] & 0x8000) == 0) {
|
||||
param->candidates[i] = param->candidates[i] | 0x8000;
|
||||
if (*remaining == 0) {
|
||||
if (*count != i) {
|
||||
param->candidates[*count] = param->candidates[i];
|
||||
}
|
||||
++*count;
|
||||
*count = *count + 1;
|
||||
} else {
|
||||
*remaining = *remaining - 1;
|
||||
Zi8_81483308(param, param->candidates[i], inserted, ZI_WORK);
|
||||
}
|
||||
}
|
||||
}
|
||||
*remaining = 0;
|
||||
} else {
|
||||
for (filter.compactIndex = 0; filter.compactIndex < *count; filter.compactIndex++) {
|
||||
if ((param->candidates[filter.compactIndex] & 0x8000) == 0) {
|
||||
param->candidates[filter.compactIndex] |= 0x8000;
|
||||
Zi8_81483308(param, param->candidates[filter.compactIndex], inserted, ZI_WORK);
|
||||
for (i = 0; i < *count; i++) {
|
||||
if ((param->candidates[i] & 0x8000) == 0) {
|
||||
param->candidates[i] = param->candidates[i] | 0x8000;
|
||||
Zi8_81483308(param, param->candidates[i], inserted, ZI_WORK);
|
||||
}
|
||||
}
|
||||
*remaining = *remaining - matched;
|
||||
*remaining = *remaining - (ziU16)matched;
|
||||
*count = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
*count = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
ziU8 countOnly;
|
||||
ziU8 maxWordLength;
|
||||
ziU8 lookupMode;
|
||||
ziU8 suffixOnly;
|
||||
ziU8 controls[8];
|
||||
ziU32 maxCount;
|
||||
ziU16 capacity;
|
||||
ziU8 minWordLength;
|
||||
ziU8 flags;
|
||||
ziU16 candidateCapacity;
|
||||
ziU8 checkOnly;
|
||||
ziU8 reserved;
|
||||
} ZiKoreanCandidateOptions;
|
||||
ziU32 Zi8GetKOcandidates(ziGetParam* param, ziU8* options ZI_NEED_WORK) {
|
||||
ziBool bVar1;
|
||||
ziU8 bVar2;
|
||||
ziS32 iVar4;
|
||||
ziU32 uVar6;
|
||||
ziU8* pbVar7;
|
||||
union {
|
||||
ziU32 words[10];
|
||||
ziU8 bytes[40];
|
||||
} local_28;
|
||||
ziU8 local_57;
|
||||
ziU8 local_56;
|
||||
ziU8 local_55;
|
||||
ziU8 local_54;
|
||||
ziU8 local_53;
|
||||
ziS8 local_52;
|
||||
ziU16 local_50;
|
||||
ziU16 local_4E;
|
||||
ziU16 local_4C;
|
||||
ziU16 local_4A;
|
||||
ziU16 local_48;
|
||||
ziS32 local_44;
|
||||
ziS32 local_2C;
|
||||
ziS32 local_30;
|
||||
ziU32 local_34;
|
||||
ziU32 local_38;
|
||||
ziU32 local_3C;
|
||||
ziU32 local_40;
|
||||
|
||||
ziU32 Zi8GetKOcandidates(ziGetParam* param, ZiKoreanCandidateOptions* options ZI_NEED_WORK) {
|
||||
struct {
|
||||
ziBool matches;
|
||||
ziU8 inserted;
|
||||
ziU8 matchPass;
|
||||
ziU8 keyByte;
|
||||
ziU8 candidateCount;
|
||||
ziU8 wordIndex;
|
||||
ziU8 remainingLetters;
|
||||
ziU16 remainingCandidates;
|
||||
ziU16 previousIndex;
|
||||
ziU16 character;
|
||||
ziU16 tableCount;
|
||||
ziU16 keyIndex;
|
||||
ZiKoreanKeyEntry* entry;
|
||||
ziS32 candidateIndex;
|
||||
ziS32 prefixCount;
|
||||
ziU32 wordOffset;
|
||||
ziS32 resultCount;
|
||||
ziS32 tableIndex;
|
||||
ziU8* wordTable;
|
||||
union {
|
||||
ziU32 firstWord;
|
||||
ziU8 bytes[5];
|
||||
} packedKeys;
|
||||
} search;
|
||||
ziU8* keyTable;
|
||||
ziU8* wordNode;
|
||||
|
||||
search.previousIndex = 0xFFFF;
|
||||
search.resultCount = 0;
|
||||
search.packedKeys.firstWord = 0;
|
||||
search.packedKeys.bytes[4] = 0;
|
||||
search.remainingLetters = 0;
|
||||
search.wordIndex = 0;
|
||||
search.candidateCount = 0;
|
||||
search.keyByte = 0;
|
||||
search.remainingCandidates = param->firstCandidate;
|
||||
search.prefixCount = 0;
|
||||
search.candidateIndex = 0;
|
||||
search.inserted = 0;
|
||||
local_4E = 0xFFFF;
|
||||
local_34 = 0;
|
||||
local_28.words[0] = 0;
|
||||
local_28.bytes[4] = 0;
|
||||
local_52 = 0;
|
||||
local_53 = 0;
|
||||
local_54 = 0;
|
||||
local_55 = 0;
|
||||
local_50 = param->firstCandidate;
|
||||
local_3C = 0;
|
||||
local_40 = 0;
|
||||
local_57 = 0;
|
||||
Zi8LogError(100, ZI_WORK);
|
||||
Zi8_81483264(param, ZI_WORK);
|
||||
keyTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 9, ZI_WORK);
|
||||
search.wordTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 10, ZI_WORK);
|
||||
if (keyTable == 0) {
|
||||
iVar4 = Zi8GetTableAddress(ZI8_LANG_KO, 9, ZI_WORK);
|
||||
local_2C = Zi8GetTableAddress(ZI8_LANG_KO, 10, ZI_WORK);
|
||||
if (iVar4 == 0) {
|
||||
Zi8ReplaceLastError(0x76C, ZI_WORK);
|
||||
return 0;
|
||||
uVar6 = 0;
|
||||
} else {
|
||||
if (search.wordTable == 0) {
|
||||
if (local_2C == 0) {
|
||||
Zi8ReplaceLastError(0x776, ZI_WORK);
|
||||
return 0;
|
||||
uVar6 = 0;
|
||||
goto LAB_000114C4;
|
||||
}
|
||||
if (options->countOnly == 0) {
|
||||
if (*options == 0) {
|
||||
param->letters = 0;
|
||||
param->unk_0x20 = 0;
|
||||
param->count = 0;
|
||||
param->candidates[0] = 0;
|
||||
}
|
||||
Zi8LogError(100, ZI_WORK);
|
||||
if (param->wordCharCount != 0) {
|
||||
if (((search.keyIndex = Zi8_8148302C(param->currentWord[0], keyTable, ZI_WORK)) != 0xFFFF) &&
|
||||
((((ZiKoreanKeyEntry*)(((search.keyIndex << 3) + search.keyIndex) + keyTable))->keyBytes[4] & 8) != 0)) {
|
||||
search.wordOffset = ((ZiKoreanKeyEntry*)(((search.keyIndex << 3) + search.keyIndex) + keyTable))->childLow |
|
||||
((((ZiKoreanKeyEntry*)(((search.keyIndex << 3) + search.keyIndex) + keyTable))->keyBytes[4] & 3) << 16 |
|
||||
((ZiKoreanKeyEntry*)(((search.keyIndex << 3) + search.keyIndex) + keyTable))->childHigh << 8);
|
||||
search.remainingLetters = param->wordCharCount - 1;
|
||||
search.wordIndex = 1;
|
||||
wordNode = search.wordTable + search.wordOffset;
|
||||
match_word:
|
||||
while (search.remainingLetters != 0) {
|
||||
search.keyIndex = Zi8_8148302C(param->currentWord[search.wordIndex], (ziU8*)keyTable, ZI_WORK);
|
||||
if (search.keyIndex == (((ziU16)*wordNode & 0x1F) << 8 | (ziU16)wordNode[1])) {
|
||||
--search.remainingLetters;
|
||||
++search.wordIndex;
|
||||
if ((*wordNode & 0x40) != 0) {
|
||||
search.remainingLetters = param->wordCharCount - 1;
|
||||
search.wordIndex = 1;
|
||||
break;
|
||||
local_48 = Zi8_8148302C(param->currentWord[0], (ziU8*)iVar4, ZI_WORK);
|
||||
if ((local_48 != 0xFFFF) &&
|
||||
((((ziU8*)iVar4)[((ziU32)local_48 * 9) + 4] & 8) != 0)) {
|
||||
local_38 = (ziU32)((ziU8*)iVar4)[((ziU32)local_48 * 9) + 6] |
|
||||
((ziU32)((ziU8*)iVar4)[((ziU32)local_48 * 9) + 4] & 3) << 16 |
|
||||
(ziU32)((ziU8*)iVar4)[((ziU32)local_48 * 9) + 5] << 8;
|
||||
local_52 = param->wordCharCount - 1;
|
||||
local_53 = 1;
|
||||
pbVar7 = (ziU8*)(local_2C + local_38);
|
||||
LAB_00010D44:
|
||||
if (local_52 != 0) {
|
||||
local_48 = Zi8_8148302C(param->currentWord[local_53], (ziU8*)iVar4, ZI_WORK);
|
||||
if (local_48 == (ziU16)((*pbVar7 & 0x1F) << 8 | pbVar7[1])) {
|
||||
local_52 = local_52 - 1;
|
||||
local_53 = local_53 + 1;
|
||||
if ((*pbVar7 & 0x40) == 0) {
|
||||
pbVar7 = pbVar7 + 2;
|
||||
goto LAB_00010D44;
|
||||
}
|
||||
wordNode += 2;
|
||||
local_52 = param->wordCharCount - 1;
|
||||
local_53 = 1;
|
||||
} else {
|
||||
search.wordIndex = 1;
|
||||
search.remainingLetters = param->wordCharCount - 1;
|
||||
break;
|
||||
local_53 = 1;
|
||||
local_52 = param->wordCharCount - 1;
|
||||
}
|
||||
}
|
||||
if (search.remainingLetters == 0) {
|
||||
search.keyIndex = ((ziU16)*wordNode & 0x1F) << 8 | (ziU16)wordNode[1];
|
||||
search.character = (ziU16)((ziU16)((ZiKoreanKeyEntry*)(((search.keyIndex << 3) + search.keyIndex) + keyTable))->characterHigh << 8 |
|
||||
((ZiKoreanKeyEntry*)(((search.keyIndex << 3) + search.keyIndex) + keyTable))->characterLow);
|
||||
if (local_52 == 0) {
|
||||
local_48 = (*pbVar7 & 0x1F) << 8 | pbVar7[1];
|
||||
local_4C = (ziU16)(((ziU8*)((ziU32)local_48 * 9 + (ziU32)local_48 + (ziU32)iVar4))[7] << 8 |
|
||||
((ziU8*)((ziU32)local_48 * 9 + (ziU32)local_48 + (ziU32)iVar4))[8]);
|
||||
if (param->wordCharCount == 1) {
|
||||
if (search.keyIndex == search.previousIndex) {
|
||||
for (; (*wordNode & 0x40) == 0; wordNode = wordNode + 2) {
|
||||
if (local_48 == local_4E) {
|
||||
for (; (*pbVar7 & 0x40) == 0; pbVar7 = pbVar7 + 2) {
|
||||
}
|
||||
wordNode += 2;
|
||||
search.remainingLetters = param->wordCharCount - 1;
|
||||
search.wordIndex = 1;
|
||||
goto next_word;
|
||||
local_52 = param->wordCharCount;
|
||||
goto LAB_00011114;
|
||||
}
|
||||
search.previousIndex = search.keyIndex;
|
||||
local_4E = local_48;
|
||||
if (param->elementCount == 0) {
|
||||
if (search.remainingCandidates != 0) {
|
||||
--search.remainingCandidates;
|
||||
} else {
|
||||
if (options->countOnly != 0) {
|
||||
if (++search.prefixCount < (ziS32)options->maxCount) {
|
||||
goto skip_word;
|
||||
if (local_50 == 0) {
|
||||
if (*options != 0) {
|
||||
local_3C = local_3C + 1;
|
||||
if ((ziS32)local_3C < *(ziS32*)(options + 0xC)) {
|
||||
goto LAB_000110E8;
|
||||
}
|
||||
return options->maxCount;
|
||||
uVar6 = *(ziU32*)(options + 0xC);
|
||||
goto LAB_000114C4;
|
||||
}
|
||||
param->candidates[search.candidateCount++] = search.character;
|
||||
++param->unk_0x20;
|
||||
if (++param->letters >= param->maxCandidates) {
|
||||
return param->letters;
|
||||
param->candidates[local_54] = local_4C;
|
||||
local_54 = local_54 + 1;
|
||||
param->count = param->count + 1;
|
||||
bVar2 = param->letters + 1;
|
||||
param->letters = bVar2;
|
||||
if (param->maxCandidates <= bVar2) {
|
||||
uVar6 = param->letters;
|
||||
goto LAB_000114C4;
|
||||
}
|
||||
} else {
|
||||
local_50 = local_50 + -1;
|
||||
}
|
||||
} else {
|
||||
param->candidates[search.candidateCount++] = search.character;
|
||||
++param->unk_0x20;
|
||||
if (++param->letters >= param->maxCandidates) {
|
||||
Zi8_814834AC(param, &search.remainingCandidates, &search.candidateCount, &search.inserted, ZI_WORK);
|
||||
param->unk_0x20 = search.candidateCount;
|
||||
param->letters = search.candidateCount;
|
||||
if (search.candidateCount < param->maxCandidates) goto skip_word;
|
||||
if (options->countOnly != 0) {
|
||||
if ((search.prefixCount += search.candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
|
||||
param->unk_0x20 = 0;
|
||||
param->candidates[local_54] = local_4C;
|
||||
local_54 = local_54 + 1;
|
||||
param->count = param->count + 1;
|
||||
bVar2 = param->letters + 1;
|
||||
param->letters = bVar2;
|
||||
if (param->maxCandidates <= bVar2) {
|
||||
Zi8_814834AC(param, &local_50, &local_54, &local_57, ZI_WORK);
|
||||
param->count = local_54;
|
||||
param->letters = local_54;
|
||||
if (param->maxCandidates <= local_54) {
|
||||
if (*options == 0) {
|
||||
uVar6 = local_54;
|
||||
goto LAB_000114C4;
|
||||
}
|
||||
local_3C = local_3C + local_54;
|
||||
if (*(ziS32*)(options + 0xC) <= (ziS32)local_3C) {
|
||||
uVar6 = *(ziU32*)(options + 0xC);
|
||||
goto LAB_000114C4;
|
||||
}
|
||||
param->count = 0;
|
||||
param->letters = 0;
|
||||
search.candidateCount = 0;
|
||||
} else {
|
||||
return search.candidateCount;
|
||||
local_54 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (search.candidateIndex = 0; search.candidateIndex < search.candidateCount; search.candidateIndex++) {
|
||||
if (search.character == param->candidates[search.candidateIndex]) break;
|
||||
for (local_40 = 0;
|
||||
(local_40 < local_54 &&
|
||||
(local_4C != param->candidates[local_40]));
|
||||
local_40 = local_40 + 1) {
|
||||
}
|
||||
if ((search.candidateIndex == search.candidateCount) &&
|
||||
(Zi8_814833F0(param, search.character, ZI_WORK) == 0)) {
|
||||
param->candidates[search.candidateCount++] = search.character;
|
||||
++param->unk_0x20;
|
||||
if (++param->letters < param->maxCandidates) {
|
||||
goto skip_word;
|
||||
if ((local_40 == local_54) &&
|
||||
(Zi8_814833F0(param, local_4C, ZI_WORK) == 0)) {
|
||||
param->candidates[local_54] = local_4C;
|
||||
local_54 = local_54 + 1;
|
||||
param->count = param->count + 1;
|
||||
bVar2 = param->letters + 1;
|
||||
param->letters = bVar2;
|
||||
if (bVar2 < param->maxCandidates) {
|
||||
goto LAB_000110E8;
|
||||
}
|
||||
Zi8_814834AC(param, &search.remainingCandidates, &search.candidateCount, &search.inserted, ZI_WORK);
|
||||
param->unk_0x20 = search.candidateCount;
|
||||
param->letters = search.candidateCount;
|
||||
if (search.candidateCount < param->maxCandidates) goto skip_word;
|
||||
if (options->countOnly != 0) {
|
||||
if ((search.prefixCount += search.candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
|
||||
param->unk_0x20 = 0;
|
||||
Zi8_814834AC(param, &local_50, &local_54, &local_57, ZI_WORK);
|
||||
param->count = local_54;
|
||||
param->letters = local_54;
|
||||
if (param->maxCandidates <= local_54) {
|
||||
if (*options == 0) {
|
||||
uVar6 = local_54;
|
||||
goto LAB_000114C4;
|
||||
}
|
||||
local_3C = local_3C + local_54;
|
||||
if (*(ziS32*)(options + 0xC) <= (ziS32)local_3C) {
|
||||
uVar6 = *(ziU32*)(options + 0xC);
|
||||
goto LAB_000114C4;
|
||||
}
|
||||
param->count = 0;
|
||||
param->letters = 0;
|
||||
search.candidateCount = 0;
|
||||
} else {
|
||||
return search.candidateCount;
|
||||
local_54 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
skip_word:
|
||||
for (; (*wordNode & 0x40) == 0; wordNode = wordNode + 2) {
|
||||
LAB_000110E8:
|
||||
for (; (*pbVar7 & 0x40) == 0; pbVar7 = pbVar7 + 2) {
|
||||
}
|
||||
wordNode += 2;
|
||||
search.remainingLetters = param->wordCharCount - 1;
|
||||
search.wordIndex = 1;
|
||||
next_word:
|
||||
if ((*wordNode & 0x80) != 0) {
|
||||
goto search_table;
|
||||
local_52 = param->wordCharCount;
|
||||
LAB_00011114:
|
||||
local_52 = local_52 + -1;
|
||||
local_53 = 1;
|
||||
pbVar7 = pbVar7 + 2;
|
||||
if ((*pbVar7 & 0x80) != 0) {
|
||||
goto LAB_00011124;
|
||||
}
|
||||
goto match_word;
|
||||
goto LAB_00010D44;
|
||||
}
|
||||
}
|
||||
search_table:
|
||||
search.resultCount = search.prefixCount;
|
||||
if (search.candidateCount != 0) {
|
||||
Zi8_814834AC(param, &search.remainingCandidates, &search.candidateCount, &search.inserted, ZI_WORK);
|
||||
if (options->countOnly != 0) {
|
||||
if ((search.prefixCount += search.candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
|
||||
search.resultCount = search.prefixCount;
|
||||
LAB_00011124:
|
||||
local_34 = local_3C;
|
||||
if (local_54 != 0) {
|
||||
Zi8_814834AC(param, &local_50, &local_54, &local_57, ZI_WORK);
|
||||
uVar6 = local_34;
|
||||
if ((*options != 0) &&
|
||||
(local_3C = local_3C + local_54, uVar6 = local_3C,
|
||||
*(ziS32*)(options + 0xC) <= (ziS32)local_3C)) {
|
||||
uVar6 = *(ziU32*)(options + 0xC);
|
||||
goto LAB_000114C4;
|
||||
}
|
||||
param->unk_0x20 = search.candidateCount;
|
||||
param->letters = search.candidateCount;
|
||||
local_34 = uVar6;
|
||||
param->count = local_54;
|
||||
param->letters = local_54;
|
||||
}
|
||||
if (param->elementCount > 9) {
|
||||
param->letters = 0;
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
if (param->elementCount != 0 && options->countOnly == 0) {
|
||||
search.matchPass = 0;
|
||||
if (param->elementCount < 10) {
|
||||
if ((param->elementCount == 0) || (*options != 0)) {
|
||||
local_56 = 1;
|
||||
} else {
|
||||
search.matchPass = 1;
|
||||
local_56 = 0;
|
||||
}
|
||||
search.tableCount = Zi8GetTableCount(ZI8_LANG_KO, 9, ZI_WORK);
|
||||
Zi8_81483118(param, search.packedKeys.bytes);
|
||||
local_4A = Zi8GetTableCount(ZI8_LANG_KO, 9, ZI_WORK);
|
||||
Zi8_81483118(param, local_28.bytes);
|
||||
do {
|
||||
for (search.tableIndex = 0; search.tableIndex < search.tableCount; search.tableIndex = search.tableIndex + 1) {
|
||||
search.matches = ZI8_TRUE;
|
||||
search.entry = (ZiKoreanKeyEntry*)(((search.tableIndex << 3) + search.tableIndex) + keyTable);
|
||||
search.keyByte = 0;
|
||||
for (local_30 = 0; local_30 < (ziS32)(ziU32)local_4A; local_30 = local_30 + 1) {
|
||||
bVar1 = ZI8_TRUE;
|
||||
local_44 = iVar4 + local_30 * 9;
|
||||
local_55 = 0;
|
||||
if (1 < param->elementCount) {
|
||||
for (search.keyByte = 0;
|
||||
(ziS32)search.keyByte < (int)param->elementCount / 2;
|
||||
search.keyByte++) {
|
||||
if (search.packedKeys.bytes[search.keyByte] != search.entry->keyBytes[search.keyByte]) {
|
||||
search.matches = ZI8_FALSE;
|
||||
for (local_55 = 0;
|
||||
(ziU32)local_55 < (ziU32)((ziS32)(ziU32)param->elementCount >> 1);
|
||||
local_55 = local_55 + 1) {
|
||||
if (local_28.bytes[local_55] != *(ziU8*)(local_44 + local_55)) {
|
||||
bVar1 = ZI8_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((search.matches && ((param->elementCount % 2) != 0)) &&
|
||||
((search.packedKeys.bytes[search.keyByte] & 0xF0) !=
|
||||
(search.entry->keyBytes[search.keyByte] & 0xF0))) {
|
||||
search.matches = ZI8_FALSE;
|
||||
if ((bVar1 && ((param->elementCount & 1) != 0)) &&
|
||||
((local_28.bytes[local_55] & 0xF0) !=
|
||||
(*(ziU8*)(local_44 + local_55) & 0xF0))) {
|
||||
bVar1 = ZI8_FALSE;
|
||||
}
|
||||
if (search.matches) {
|
||||
if (param->elementCount % 2 != 0) {
|
||||
if ((search.entry->keyBytes[search.keyByte] & 0xF) != 0) {
|
||||
if (search.matchPass == 0) goto next_entry;
|
||||
} else if (search.matchPass != 0 && options->countOnly == 0) {
|
||||
goto next_entry;
|
||||
if (bVar1) {
|
||||
bVar2 = local_56;
|
||||
if ((param->elementCount & 1) == 0) {
|
||||
if ((*(ziU8*)(local_44 + local_55) & 0xF0) == 0) {
|
||||
if (local_56 == 0) {
|
||||
goto LAB_000113B0;
|
||||
}
|
||||
bVar2 = *options;
|
||||
}
|
||||
if (bVar2 == 0) {
|
||||
goto LAB_00011478;
|
||||
}
|
||||
} else {
|
||||
if ((search.entry->keyBytes[search.keyByte] & 0xF0) != 0) {
|
||||
if (search.matchPass == 0) goto next_entry;
|
||||
} else if (search.matchPass != 0 && options->countOnly == 0) {
|
||||
goto next_entry;
|
||||
if ((*(ziU8*)(local_44 + local_55) & 0xF) != 0) {
|
||||
goto LAB_000113AC;
|
||||
}
|
||||
if (local_56 != 0) {
|
||||
bVar2 = *options;
|
||||
goto LAB_000113AC;
|
||||
}
|
||||
}
|
||||
if (search.remainingCandidates != 0) {
|
||||
--search.remainingCandidates;
|
||||
} else if (options->countOnly != 0) {
|
||||
if (++search.resultCount >= (ziS32)options->maxCount) return options->maxCount;
|
||||
LAB_000113AC:
|
||||
if (bVar2 == 0) {
|
||||
goto LAB_00011478;
|
||||
}
|
||||
LAB_000113B0:
|
||||
if (local_50 == 0) {
|
||||
if (*options == 0) {
|
||||
param->candidates[local_54] =
|
||||
(ziU16)((*(ziU8*)(local_30 * 9 + iVar4 + 7) << 8) |
|
||||
*(ziU8*)(local_30 * 9 + iVar4 + 8));
|
||||
local_54 = local_54 + 1;
|
||||
bVar2 = param->letters + 1;
|
||||
param->letters = bVar2;
|
||||
if (param->maxCandidates <= bVar2) {
|
||||
uVar6 = param->letters;
|
||||
goto LAB_000114C4;
|
||||
}
|
||||
} else {
|
||||
local_34 = local_34 + 1;
|
||||
if (*(ziS32*)(options + 0xC) <= (ziS32)local_34) {
|
||||
uVar6 = *(ziU32*)(options + 0xC);
|
||||
goto LAB_000114C4;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
param->candidates[search.candidateCount++] =
|
||||
(ziU16)((ziU16)((ZiKoreanKeyEntry*)(((search.tableIndex << 3) + search.tableIndex) + keyTable))->characterHigh << 8 |
|
||||
((ZiKoreanKeyEntry*)(((search.tableIndex << 3) + search.tableIndex) + keyTable))->characterLow);
|
||||
if (++param->letters >= param->maxCandidates) return param->letters;
|
||||
local_50 = local_50 + -1;
|
||||
}
|
||||
}
|
||||
next_entry:
|
||||
LAB_00011478:
|
||||
;
|
||||
}
|
||||
} while (++search.matchPass < 2);
|
||||
local_56 = local_56 + 1;
|
||||
} while (local_56 < 2);
|
||||
uVar6 = local_34;
|
||||
if (*options == 0) {
|
||||
uVar6 = param->letters;
|
||||
}
|
||||
} else {
|
||||
param->letters = 0;
|
||||
uVar6 = 0;
|
||||
}
|
||||
if (options->countOnly != 0) return search.resultCount;
|
||||
return param->letters;
|
||||
}
|
||||
return 0;
|
||||
LAB_000114C4:
|
||||
return uVar6;
|
||||
}
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
#include <zi8clib/zconvert.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zmtkey.h>
|
||||
|
||||
typedef struct ziUserKeyMap { ziWChar* upper[32]; ziWChar* lower[32]; } ziUserKeyMap;
|
||||
|
||||
ziU16 Zi8GetTableCount(ziU8 language, ziU8 tableIndex, ziPtr __zi8_work_data);
|
||||
ziU32 Zi8GetTableAddress(ziU8 language, ziU8 tableIndex, ziPtr __zi8_work_data);
|
||||
ziU8 Zi8getKeyLayout(ziU8 language, ziWChar key, ziWChar* chars, ziU8 mode, ziPtr __zi8_work_data);
|
||||
|
||||
ziBool Zi8_81484484(ziWChar character, ziWChar* output, ziPtr __zi8_work_data) {
|
||||
if (character == 0xeffa) {
|
||||
*output = 0;
|
||||
} else if ((character >= 0xeff1) && (character <= 0xeff9)) {
|
||||
*output = character - 0xeff0;
|
||||
} else if ((character >= 0xeffb) && (character <= 0xf010)) {
|
||||
*output = character - 0xeff1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ziU8 ziNumKeysWithChars(ziU8 language, ziPtr __zi8_work_data) {
|
||||
ziU16 tableCount;
|
||||
ziU8* table;
|
||||
ziU32 totalCharacters;
|
||||
ziU32 keyIndex;
|
||||
|
||||
tableCount = Zi8GetTableCount(language, 0x1e, __zi8_work_data);
|
||||
table = (ziU8*)Zi8GetTableAddress(language, 0x1e, __zi8_work_data);
|
||||
if (tableCount == 0) {
|
||||
return 0x0c;
|
||||
}
|
||||
|
||||
keyIndex = totalCharacters = 0;
|
||||
for (; (ziU16)keyIndex < 0x20; keyIndex++) {
|
||||
totalCharacters += table[(ziU16)keyIndex];
|
||||
}
|
||||
if ((ziS32)tableCount >= (((ziS32)(totalCharacters & 0xffff) * 4) + 0x20)) {
|
||||
return 0x20;
|
||||
}
|
||||
return 0x0c;
|
||||
}
|
||||
|
||||
ziBool Zi8getKeyLayout(ziU8 language, ziWChar key, ziWChar* chars, ziU8 mode, ziPtr __zi8_work_data) {
|
||||
ziU16 tableCount;
|
||||
ziU8 numKeys;
|
||||
ziU8* dataAddress;
|
||||
ziUserKeyMap* customTable;
|
||||
ziU16 charCount;
|
||||
ziU16 keyIndex;
|
||||
ziWChar* keyChars;
|
||||
|
||||
dataAddress = 0;
|
||||
numKeys = ziNumKeysWithChars(language, __zi8_work_data);
|
||||
Zi8LogError(0x64, __zi8_work_data);
|
||||
*chars = 0;
|
||||
if (ZI_WORK->userKeys[language] != 0) {
|
||||
customTable = ZI_WORK->userKeys[language];
|
||||
if (!Zi8_81484484(key, &key, __zi8_work_data)) {
|
||||
return 0;
|
||||
}
|
||||
keyChars = customTable->lower[key];
|
||||
for (keyIndex = 0; keyChars[(ziU16)keyIndex] != 0; keyIndex++) {
|
||||
chars[(ziU16)keyIndex] = keyChars[(ziU16)keyIndex];
|
||||
}
|
||||
chars[(ziU16)keyIndex] = 0;
|
||||
return 1;
|
||||
} else {
|
||||
if (mode == 1) {
|
||||
goto table_1e;
|
||||
}
|
||||
if ((tableCount = Zi8GetTableCount(language, 0x1d, __zi8_work_data)) == 0) {
|
||||
goto table_1e;
|
||||
}
|
||||
{
|
||||
dataAddress = (ziU8*)Zi8GetTableAddress(language, 0x1d, __zi8_work_data);
|
||||
goto tables_ready;
|
||||
}
|
||||
table_1e:
|
||||
if ((tableCount = Zi8GetTableCount(language, 0x1e, __zi8_work_data)) != 0) {
|
||||
dataAddress = (ziU8*)Zi8GetTableAddress(language, 0x1e, __zi8_work_data);
|
||||
}
|
||||
tables_ready:
|
||||
if (dataAddress == 0) {
|
||||
Zi8ReplaceLastError(0x962, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
if (!Zi8_81484484(key, &key, __zi8_work_data) || (key >= numKeys)) {
|
||||
Zi8ReplaceLastError(300, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
tableCount = 0;
|
||||
keyIndex = tableCount;
|
||||
for (; (ziU16)keyIndex < key; keyIndex++) {
|
||||
tableCount += dataAddress[(ziU16)keyIndex];
|
||||
}
|
||||
if ((charCount = (ziU8)dataAddress[key]) == 0) {
|
||||
return 0;
|
||||
}
|
||||
dataAddress = dataAddress + numKeys + (tableCount * 2);
|
||||
keyIndex = 0;
|
||||
for (; (ziU16)keyIndex < charCount; keyIndex++) {
|
||||
chars[(ziU16)keyIndex] = (ziU16)dataAddress[(ziU16)keyIndex * 2] |
|
||||
((ziU16)dataAddress[((ziU16)keyIndex * 2) + 1] << 8);
|
||||
}
|
||||
chars[(ziU16)keyIndex] = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
ziBool Zi8ChangeCharCase(ziBool upper, ziWChar* character, ziU8 language ZI_NEED_WORK) {
|
||||
ziU8 changed;
|
||||
ziU16 total;
|
||||
ziU16 tableCount;
|
||||
ziU8* dataAddress;
|
||||
ziUserKeyMap* customTables;
|
||||
ziU8 numKeys;
|
||||
ziS16 direction;
|
||||
ziU16 result;
|
||||
ziS32 keyIndex;
|
||||
ziPtr from;
|
||||
ziPtr to;
|
||||
ziS32 characterIndex;
|
||||
|
||||
customTables = 0;
|
||||
dataAddress = 0;
|
||||
changed = 0;
|
||||
numKeys = 0x20;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
if (ZI_WORK->userKeys[language] != 0) {
|
||||
customTables = (ziUserKeyMap*)ZI_WORK->userKeys[language];
|
||||
} else if (ZI_WORK->unk_0x11FC != 0) {
|
||||
customTables = (ziUserKeyMap*)ZI_WORK->unk_0x11FC;
|
||||
} else {
|
||||
tableCount = Zi8GetTableCount(language, 0x1e, ZI_WORK);
|
||||
if (tableCount != 0) {
|
||||
dataAddress = (ziU8*)Zi8GetTableAddress(language, 0x1e, ZI_WORK);
|
||||
numKeys = ziNumKeysWithChars(language, ZI_WORK);
|
||||
} else {
|
||||
Zi8ReplaceLastError(0x138d, ZI_WORK);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (customTables != 0) {
|
||||
for (keyIndex = 0; (changed == 0) && (keyIndex < (ziS32)(ziU32)numKeys); keyIndex++) {
|
||||
if (upper != 0) {
|
||||
from = (ziPtr)customTables->lower[keyIndex];
|
||||
to = (ziPtr)customTables->upper[keyIndex];
|
||||
} else {
|
||||
from = (ziPtr)customTables->upper[keyIndex];
|
||||
to = (ziPtr)customTables->lower[keyIndex];
|
||||
}
|
||||
if ((from != 0) && (to != 0)) {
|
||||
for (characterIndex = 0; ((ziU16)((ziS16*)from)[characterIndex]) != 0; characterIndex++) {
|
||||
if ((ziU16)((ziS16*)from)[characterIndex] == *character) {
|
||||
*character = (ziU16)((ziWChar*)to)[characterIndex];
|
||||
changed = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dataAddress != 0) {
|
||||
total = 0;
|
||||
for (keyIndex = 0; keyIndex < (ziS32)(ziU32)numKeys; keyIndex++) {
|
||||
total += dataAddress[keyIndex];
|
||||
}
|
||||
dataAddress = dataAddress + numKeys;
|
||||
direction = 1;
|
||||
if (upper == 0) {
|
||||
dataAddress = dataAddress + ((ziU32)total * 2);
|
||||
direction = -1;
|
||||
}
|
||||
for (keyIndex = 0; keyIndex < (ziS32)(ziU32)total; keyIndex++) {
|
||||
tableCount = (ziU16)(dataAddress[(keyIndex * 2)] |
|
||||
((ziU16)dataAddress[(keyIndex * 2) + 1] << 8));
|
||||
if (tableCount == *character) {
|
||||
dataAddress = dataAddress + ((ziS32)direction * ((ziU32)total * 2));
|
||||
*character = (ziU16)(dataAddress[(keyIndex * 2)] |
|
||||
((ziU16)dataAddress[(keyIndex * 2) + 1] << 8));
|
||||
changed = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed == 0) {
|
||||
result = 0;
|
||||
if (upper != 0) {
|
||||
if (((*character >= 0x61) && (*character <= 0x7a)) || ((*character >= 0xf1) && (*character <= 0xf6)) ||
|
||||
((*character >= 0xf8) && (*character <= 0xfe)) || ((*character >= 0xe0) && (*character <= 0xef))) {
|
||||
result = *character - 0x20;
|
||||
} else if (*character == 0xff) {
|
||||
result = 0x178;
|
||||
}
|
||||
} else {
|
||||
if (((*character >= 0x41) && (*character <= 0x5a)) || ((*character >= 0xd1) && (*character <= 0xd6)) ||
|
||||
((*character >= 0xd8) && (*character <= 0xde)) || ((*character >= 0xc0) && (*character <= 0xcf))) {
|
||||
result = *character + 0x20;
|
||||
} else if (*character == 0x178) {
|
||||
result = 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
if ((result != 0) && Zi8ConvertWC2UC(result, language, ZI_WORK)) {
|
||||
*character = result;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
#include <stddef.h>
|
||||
#include <zi8clib/zitypes.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zconvert.h>
|
||||
#include <zi8clib/zmtkey.h>
|
||||
|
||||
ziU8 Zi8AttachOEMdata(ziU8 (*match)(ziU16, ziWChar*, ziU8, ziPtr), ziU16 count, ziPtr data ZI_NEED_WORK) {
|
||||
ZI_WORK->oemMatch = match;
|
||||
ZI_WORK->oemLen = count;
|
||||
ZI_WORK->oemData = data;
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
return 1;
|
||||
}
|
||||
ziU8 Zi8DetachOEMdata(ziU8 id ZI_NEED_WORK) {
|
||||
Zi8LogError(100, __zi8_work_data);
|
||||
if (id != 1 || ZI_WORK->oemMatch == 0) return 0;
|
||||
{
|
||||
ZI_WORK->oemMatch = 0;
|
||||
ZI_WORK->oemLen = 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ziU8 Zi8MatchOEMdata(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* word, ziU16 capacity, ziBool complete, ziBool continuation ZI_NEED_WORK) {
|
||||
ziWChar folded;
|
||||
ziS32 index;
|
||||
ziU32 position;
|
||||
ziU32 fallback = 0;
|
||||
if (!continuation) ZI_WORK->oemIdx = 0;
|
||||
index = ZI_WORK->oemIdx;
|
||||
if ((ziS32)index >= ZI_WORK->oemLen) goto failed;
|
||||
if (ZI_WORK->oemMatch == 0) goto failed;
|
||||
capacity--;
|
||||
if ((ziS32)length >= (ziS32)capacity) {
|
||||
failed:
|
||||
return 0;
|
||||
}
|
||||
word[capacity] = 0;
|
||||
if (complete) word[length] = 1; else word[length] = 0;
|
||||
goto matchRetry;
|
||||
posEntry:
|
||||
position = 0;
|
||||
if ((complete && word[length] == 0) || (!complete && word[length] != 0)) {
|
||||
for (; (ziS32)position < length; position++) {
|
||||
if (pattern[position] >= 0xEFF1 && pattern[position] <= 0xF37F) {
|
||||
if (pattern[position] == Zi8ConvertWC2Key(word[position], language, __zi8_work_data)) continue;
|
||||
break;
|
||||
} else if (word[position] != pattern[position]) {
|
||||
if (!ZI_WORK->unk_0x1F || language == 1) break;
|
||||
folded = pattern[position];
|
||||
if (!Zi8ChangeCharCase(1, &folded, language, __zi8_work_data) || folded != word[position]) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ziS32)position < length) {
|
||||
if (complete) word[length] = 1; else word[length] = 0;
|
||||
index++;
|
||||
if ((ziS32)index >= ZI_WORK->oemLen) goto oemFailed;
|
||||
goto matchRetry;
|
||||
}
|
||||
if (fallback) {
|
||||
index = 0;
|
||||
*word = *pattern;
|
||||
return 1;
|
||||
}
|
||||
index++;
|
||||
ZI_WORK->oemIdx = index;
|
||||
while (word[position] != 0) position++;
|
||||
return position;
|
||||
matchRetry:
|
||||
if ((ziS32)index >= ZI_WORK->oemLen) goto oemFailed;
|
||||
if (!ZI_WORK->oemMatch(index, word, capacity, ZI_WORK->oemData)) goto oemFailed;
|
||||
goto posEntry;
|
||||
oemFailed:
|
||||
if (length != 1 || !complete || continuation) goto tail0;
|
||||
complete = 0;
|
||||
fallback = 1;
|
||||
index = 0;
|
||||
goto matchRetry;
|
||||
tail0:
|
||||
return 0;
|
||||
}
|
||||
@@ -1,336 +0,0 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
|
||||
void Zi8Memset(ziPtr, ziU32, ziU32);
|
||||
void Zi8Memcpy(ziPtr, ziPtr, ziU32);
|
||||
ziBool Zi8IsComponent(ziWChar ZI_NEED_WORK);
|
||||
ziU32 Zi8GetTableAddress(ziU8, ziU8 ZI_NEED_WORK);
|
||||
ziU16 Zi8GetTableCount(ziU8, ziU8 ZI_NEED_WORK);
|
||||
ziU8 Zi8GetPyPhonetic(ziWChar*, ziU8, ziWChar*, ziWChar*, ziU8*, ziWChar*, ziWChar* ZI_NEED_WORK);
|
||||
ziU8 Zi8GetBpmfPhonetic(ziWChar*, ziU8, ziWChar*, ziWChar*, ziWChar*, ziWChar* ZI_NEED_WORK);
|
||||
|
||||
ziBool Zi8PrepareMatch(ziGetParam* request, ziMatchParam* match, ziU8 skipMode ZI_NEED_WORK) {
|
||||
ziU16 element;
|
||||
ziU16 phoneticCount;
|
||||
ziU16 phoneticInitial;
|
||||
ziU16 phoneticMask;
|
||||
ziU16 phoneticCode;
|
||||
ziU16 phoneticLength;
|
||||
ziWChar initial;
|
||||
ziWChar final;
|
||||
ziWChar bestInitial;
|
||||
ziWChar bestFinal;
|
||||
ziWChar previousInitial;
|
||||
ziWChar previousFinal;
|
||||
ziU8 elementCount;
|
||||
ziU8 elementIndex;
|
||||
ziU8 stroke;
|
||||
ziU8 contextMask;
|
||||
ziU8 mode;
|
||||
ziU8 savedNibbles;
|
||||
struct {
|
||||
ziWChar* phoneticInput;
|
||||
ziU8* phoneticTable;
|
||||
ziU8 strokePrefix[4];
|
||||
ziU8 maskPrefix[4];
|
||||
ziU8* componentIndex;
|
||||
ziU8* component;
|
||||
ziU8 strokes[12];
|
||||
ziU8 masks[12];
|
||||
} buffers;
|
||||
ziU8 nibbles;
|
||||
ziU8 index;
|
||||
|
||||
stroke = 0;
|
||||
contextMask = 0x20;
|
||||
Zi8Memset(match,0,0x1ee);
|
||||
nibbles = 0;
|
||||
elementIndex = 0;
|
||||
elementCount = request->elementCount;
|
||||
while (elementCount != 0) {
|
||||
if (request->elements[elementCount - 1] != 0xEF09) break;
|
||||
elementCount--;
|
||||
}
|
||||
match->count = elementCount;
|
||||
for (index = 0; index < elementCount; index++) {
|
||||
if (request->elements[index] != 0xEF00) {
|
||||
match->count = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (elementCount != 0) {
|
||||
match->comp = element = request->elements[0];
|
||||
if (Zi8IsComponent(element,__zi8_work_data) != 0) {
|
||||
elementIndex++;
|
||||
buffers.component = (ziU8*)Zi8GetTableAddress(1,2,__zi8_work_data);
|
||||
buffers.componentIndex = (ziU8*)Zi8GetTableAddress(1,6,__zi8_work_data);
|
||||
buffers.componentIndex += (element - 0xef10) * 2;
|
||||
match->field22 = (((ziU16)buffers.componentIndex[1] & 0x3f) << 8) + *buffers.componentIndex;
|
||||
buffers.component += (ziU32)match->field22 * 8;
|
||||
switch(*buffers.component & 0xf) {
|
||||
case 0:
|
||||
case 9:
|
||||
case 10:
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
match->comp = 0xEF00 + 4;
|
||||
break;
|
||||
case 2:
|
||||
match->comp = 0xEF00 + 1;
|
||||
break;
|
||||
case 3:
|
||||
case 0xb:
|
||||
match->comp = 0xEF00 + 7;
|
||||
break;
|
||||
case 4:
|
||||
match->comp = 0xEF00 + 6;
|
||||
break;
|
||||
case 5:
|
||||
match->comp = 0xEF00 + 3;
|
||||
break;
|
||||
case 6:
|
||||
match->comp = 0xEF00 + 5;
|
||||
break;
|
||||
case 7:
|
||||
match->comp = 0xEF00 + 8;
|
||||
break;
|
||||
case 8:
|
||||
match->comp = 0xEF00 + 2;
|
||||
}
|
||||
for (index = 0; index < (buffers.component[5] >> 1) + 1; index++) {
|
||||
if (index < 4) {
|
||||
match->arrD[index] = buffers.component[index];
|
||||
match->arr1[index] = 0xff;
|
||||
}
|
||||
}
|
||||
if ((index != 0) && ((buffers.component[5] & 1) == 0)) {
|
||||
index--;
|
||||
match->arrD[index] &= 0xf0;
|
||||
match->arr1[index] &= 0xf0;
|
||||
}
|
||||
nibbles = (ziU8)(buffers.component[5] + 1);
|
||||
if (8 < nibbles) {
|
||||
nibbles++;
|
||||
}
|
||||
}
|
||||
}
|
||||
match->arr1[0] &= 0xf;
|
||||
match->arrD[0] &= 0xf;
|
||||
if (skipMode == '\0') {
|
||||
mode = 0;
|
||||
if ((request->subLanguage & 0x80) != 0 || (request->subLanguage & 0x40) != 0) {
|
||||
mode = 1;
|
||||
} else if ((request->subLanguage & 8) != 0) {
|
||||
mode = 4;
|
||||
} else if ((request->subLanguage & 0x20) != 0 || (request->subLanguage & 0x10) != 0) {
|
||||
mode = 2;
|
||||
}
|
||||
if (mode == 0) {
|
||||
mode = request->subLanguage;
|
||||
}
|
||||
switch (mode) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
match->arr1[0] |= (ziU8)(mode << 4);
|
||||
match->arrD[0] |= (ziU8)(mode << 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nibbles == 0) {
|
||||
nibbles = 1;
|
||||
}
|
||||
if (((request->getMode == '\0') || (request->getMode == '\x10')) ||
|
||||
(request->getMode == '\x05')) {
|
||||
Zi8Memcpy(buffers.masks,match->arr1,0xc);
|
||||
Zi8Memcpy(buffers.strokes,match->arrD,0xc);
|
||||
do {
|
||||
while (elementIndex < elementCount) {
|
||||
element = request->elements[elementIndex++];
|
||||
switch (element) {
|
||||
case 0xef02: stroke = 0; break;
|
||||
case 0xef04: stroke = 1; break;
|
||||
case 0xef01: stroke = 2; break;
|
||||
case 0xef07: stroke = 3; break;
|
||||
case 0xef06: stroke = 4; break;
|
||||
case 0xef03: stroke = 5; break;
|
||||
case 0xef05: stroke = 6; break;
|
||||
case 0xef08: stroke = 7; break;
|
||||
case 0xef0b: stroke = 8; break;
|
||||
case 0xef0a: stroke = 4; break;
|
||||
case 0xf360: stroke = 0xff; break;
|
||||
default: stroke = 0; break;
|
||||
}
|
||||
if (stroke == 0xff) break;
|
||||
if (0x17 < nibbles) {
|
||||
match->length = 0x18;
|
||||
return 0;
|
||||
}
|
||||
if (nibbles == 8) {
|
||||
nibbles++;
|
||||
}
|
||||
if ((nibbles & 1) != 0) {
|
||||
buffers.strokes[nibbles >> 1] |= stroke;
|
||||
if (element == 0xef0b) {
|
||||
buffers.masks[nibbles >> 1] |= 8;
|
||||
}
|
||||
else if (element == 0xef0a) {
|
||||
buffers.masks[nibbles >> 1] |= 4;
|
||||
}
|
||||
else if (element != 0xef00) {
|
||||
buffers.masks[nibbles >> 1] |= 7;
|
||||
}
|
||||
} else {
|
||||
buffers.strokes[nibbles >> 1] |= stroke << 4;
|
||||
if (element == 0xef0b) {
|
||||
buffers.masks[nibbles >> 1] |= 0x80;
|
||||
}
|
||||
else if (element == 0xef0a) {
|
||||
buffers.masks[nibbles >> 1] |= 0x40;
|
||||
}
|
||||
else if (element != 0xef00) {
|
||||
buffers.masks[nibbles >> 1] |= 0x70;
|
||||
}
|
||||
}
|
||||
nibbles++;
|
||||
}
|
||||
savedNibbles = nibbles;
|
||||
for (index = 0; index < 4; index++) {
|
||||
buffers.maskPrefix[index] = buffers.masks[index];
|
||||
buffers.strokePrefix[index] = buffers.strokes[index];
|
||||
}
|
||||
if ((1 < nibbles) && (nibbles < 8)) {
|
||||
index = nibbles >> 1;
|
||||
if ((nibbles & 1) != 0) {
|
||||
buffers.maskPrefix[index] = buffers.maskPrefix[index] | 0xf;
|
||||
buffers.strokePrefix[index] = buffers.strokePrefix[index] | 0xf;
|
||||
} else {
|
||||
buffers.maskPrefix[index] = buffers.maskPrefix[index] | 0xf0;
|
||||
buffers.strokePrefix[index] = buffers.strokePrefix[index] | 0xf0;
|
||||
}
|
||||
}
|
||||
if (match->nSeg == 0) {
|
||||
Zi8Memcpy(match->arr1,buffers.masks,0xc);
|
||||
Zi8Memcpy(match->arrD,buffers.strokes,0xc);
|
||||
Zi8Memcpy(match->arr19,buffers.maskPrefix,4);
|
||||
Zi8Memcpy(match->arr1D,buffers.strokePrefix,4);
|
||||
match->length = savedNibbles;
|
||||
}
|
||||
Zi8Memcpy((ziU8 (*)[12])match->segs1 + match->nSeg,buffers.masks,0xc);
|
||||
Zi8Memcpy((ziU8 (*)[12])match->segsD + match->nSeg,buffers.strokes,0xc);
|
||||
match->nSeg++;
|
||||
if (stroke != 0xff || elementIndex >= elementCount || match->nSeg >= 0x10) goto complete;
|
||||
Zi8Memset(buffers.masks,0,0xc);
|
||||
Zi8Memset(buffers.strokes,0,0xc);
|
||||
buffers.masks[0] = match->arr1[0] & 0xf0;
|
||||
buffers.strokes[0] = match->arrD[0] & 0xf0;
|
||||
nibbles = 1;
|
||||
} while (1);
|
||||
}
|
||||
match->length = nibbles;
|
||||
if (elementCount != 0) {
|
||||
if ((request->getMode == '\x01') || (request->getMode == '\f')) {
|
||||
buffers.phoneticTable = (ziU8*)Zi8GetTableAddress(1,3,__zi8_work_data);
|
||||
phoneticCount = Zi8GetTableCount(1,3,__zi8_work_data);
|
||||
}
|
||||
else {
|
||||
buffers.phoneticTable = (ziU8*)Zi8GetTableAddress(1,4,__zi8_work_data);
|
||||
phoneticCount = Zi8GetTableCount(1,4,__zi8_work_data);
|
||||
}
|
||||
if ((request->getMode == '\x01') || (request->getMode == '\f')) {
|
||||
match->nCand = Zi8GetPyPhonetic(request->elements,elementCount,match->phon,match->phon2,
|
||||
&request->count,&match->first,&match->first2,__zi8_work_data);
|
||||
}
|
||||
else {
|
||||
initial = 0;
|
||||
final = 0;
|
||||
bestInitial = 0;
|
||||
bestFinal = 0;
|
||||
previousInitial = 0;
|
||||
previousFinal = 0;
|
||||
buffers.phoneticInput = request->elements;
|
||||
match->nCand = 0;
|
||||
request->count = request->elementCount;
|
||||
phoneticLength = 1;
|
||||
for (index = 0; index < elementCount; index++) {
|
||||
stroke = Zi8GetBpmfPhonetic(buffers.phoneticInput,phoneticLength,&initial,&final,&bestInitial,&bestFinal,
|
||||
__zi8_work_data);
|
||||
if (stroke != 0) {
|
||||
previousInitial = bestInitial;
|
||||
previousFinal = bestFinal;
|
||||
savePhonetic:
|
||||
match->phon[match->nCand] = initial;
|
||||
match->phon2[match->nCand] = final;
|
||||
if (match->nCand == 0) {
|
||||
match->first = bestInitial;
|
||||
match->first2 = bestFinal;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((index == 0) ||
|
||||
((((1 < phoneticLength && (buffers.phoneticInput[phoneticLength - 2] == 0xF360)) &&
|
||||
(buffers.phoneticInput[phoneticLength - 1] == 0xF360)) ||
|
||||
(++match->nCand == 0x10)))) {
|
||||
initial = 0xffff;
|
||||
final = 0xffff;
|
||||
bestInitial = 0xffff;
|
||||
bestFinal = 0xffff;
|
||||
match->nCand = 0;
|
||||
break;
|
||||
}
|
||||
if (buffers.phoneticInput[phoneticLength - 1] == 0xF360) {
|
||||
match->nCand--;
|
||||
bestInitial = previousInitial;
|
||||
bestFinal = previousFinal;
|
||||
final = bestFinal;
|
||||
initial = bestInitial;
|
||||
goto savePhonetic;
|
||||
}
|
||||
if (match->nCand == 1) {
|
||||
request->count = phoneticLength - 1;
|
||||
}
|
||||
buffers.phoneticInput = buffers.phoneticInput + phoneticLength - 1;
|
||||
phoneticLength = 0;
|
||||
index--;
|
||||
}
|
||||
phoneticLength++;
|
||||
}
|
||||
if (elementCount != 0) {
|
||||
match->phon[match->nCand] = initial;
|
||||
match->phon2[match->nCand] = final;
|
||||
if (match->nCand == 0) {
|
||||
match->first = bestInitial;
|
||||
match->first2 = bestFinal;
|
||||
}
|
||||
match->nCand++;
|
||||
}
|
||||
}
|
||||
if (((request->context & contextMask) != 0) &&
|
||||
((1 < match->nCand || (request->count != elementCount)))) {
|
||||
match->phon[0] = 0xFFFF;
|
||||
match->phon2[0] = 0xFFFF;
|
||||
match->nCand = 0;
|
||||
}
|
||||
if (((request->getOptions & 0x20) == 0) &&
|
||||
((match->phon[0] != 0xFFFF || (match->phon2[0] != 0xFFFF)))) {
|
||||
if (match->nCand > 1) {
|
||||
phoneticInitial = match->phon[match->nCand - 1] & 0xfff8;
|
||||
phoneticMask = match->phon2[match->nCand - 1] & 0xfff8;
|
||||
}
|
||||
else {
|
||||
phoneticInitial = match->phon[0] & 0xfff8;
|
||||
phoneticMask = match->phon2[0] & 0xfff8;
|
||||
}
|
||||
for (phoneticLength = 0; phoneticLength < phoneticCount; phoneticLength++) {
|
||||
phoneticCode = buffers.phoneticTable[phoneticLength * 2] | ((ziU16)buffers.phoneticTable[phoneticLength * 2 + 1] << 8);
|
||||
if (phoneticMask == (phoneticCode & phoneticInitial)) break;
|
||||
}
|
||||
if (phoneticLength == phoneticCount) {
|
||||
match->phon[0] = 0xFFFF;
|
||||
match->phon2[0] = 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
complete:
|
||||
return 1;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
#ifndef PF_FA_PDM_H
|
||||
#define PF_FA_PDM_H
|
||||
#include <private/vf/PrFILE2/dskmng/pdm_types.h>
|
||||
typedef struct PDM_PARTITION PDM_PARTITION;
|
||||
typedef struct PDM_CALLBACK {
|
||||
void (*insert)(PDM_PARTITION*);
|
||||
void (*eject)(PDM_PARTITION*);
|
||||
} PDM_CALLBACK;
|
||||
struct PDM_PARTITION {
|
||||
pf_u32 status;
|
||||
PDM_DISK* p_disk;
|
||||
pf_u32 part_id;
|
||||
pf_u32 start_sector;
|
||||
pf_u32 total_sector;
|
||||
pf_s32 driver_last_error;
|
||||
pf_u32 lock_state[2];
|
||||
PDM_CALLBACK callbacks;
|
||||
};
|
||||
struct PDM_DISK {
|
||||
pf_u32 status;
|
||||
PDM_DISK_TBL disk_tbl;
|
||||
pf_s16 init_count;
|
||||
pf_s16 mount_count;
|
||||
PDM_DISK* lock_handle;
|
||||
pf_u32 lock_count;
|
||||
PDM_DISK_INFO disk_info;
|
||||
PDM_PARTITION* p_cur_part;
|
||||
};
|
||||
typedef struct PDM_DISK_SET {
|
||||
pf_u16 num_partition;
|
||||
pf_u16 num_allocated_disk;
|
||||
PDM_DISK disk[26];
|
||||
PDM_PARTITION partition[26];
|
||||
} PDM_DISK_SET;
|
||||
extern PDM_DISK_SET pdm_disk_set;
|
||||
extern PDM_DISK_TBL pdm_drv_tbl[26];
|
||||
void pdm_part_set_driver_error_code(PDM_PARTITION*, pf_s32);
|
||||
void pdm_part_set_change_media_state(PDM_DISK*, pf_bool);
|
||||
pf_s32 pdm_disk_convert_sector_into_block(PDM_DISK*, pf_u32, pf_u32, pf_u32, pf_u32*, pf_u32*);
|
||||
pf_s32 pdm_disk_convert_block_into_sector(PDM_DISK*, pf_u32, pf_u32, pf_u32, pf_u32*, pf_u32*);
|
||||
pf_s32 pdm_disk_add_disk(PDM_INIT_DISK*, PDM_DISK**);
|
||||
pf_s32 pdm_disk_del_disk(PDM_DISK*);
|
||||
pf_s32 pdm_disk_set_disk(PDM_DISK*, PDM_PARTITION*);
|
||||
pf_s32 pdm_disk_get_media_attribute(PDM_DISK*, PDM_DISK_INFO*);
|
||||
pf_s32 pdm_disk_get_media_bps(PDM_DISK*, pf_u16*);
|
||||
pf_s32 pdm_disk_init(PDM_DISK*);
|
||||
pf_s32 pdm_disk_mount(PDM_DISK*);
|
||||
pf_s32 pdm_disk_format(PDM_DISK*, const pf_u8*);
|
||||
pf_s32 pdm_disk_physical_read(PDM_DISK*, pf_u8*, pf_u32, pf_u32, pf_u32, pf_u32*);
|
||||
pf_s32 pdm_disk_physical_write(PDM_DISK*, const pf_u8*, pf_u32, pf_u32, pf_u32, pf_u32*);
|
||||
pf_s32 pdm_disk_unmount(PDM_DISK*, pf_u32);
|
||||
pf_s32 pdm_disk_finalize(PDM_DISK*);
|
||||
#endif
|
||||
@@ -1,39 +0,0 @@
|
||||
#ifndef FA_PF_KERNEL_H
|
||||
#define FA_PF_KERNEL_H
|
||||
|
||||
#include <revolution/os.h>
|
||||
|
||||
typedef struct PFK_TASK_CONFIG {
|
||||
void* (*entry)(void*);
|
||||
void* argument;
|
||||
u32 stack_size;
|
||||
void* stack;
|
||||
s32 priority;
|
||||
OSThread* thread;
|
||||
} PFK_TASK_CONFIG;
|
||||
|
||||
typedef struct PFK_MAILBOX_CONFIG {
|
||||
OSMessageQueue* queue;
|
||||
OSMessage* messages;
|
||||
s32 count;
|
||||
} PFK_MAILBOX_CONFIG;
|
||||
|
||||
typedef struct PFK_SEMAPHORE_CONFIG {
|
||||
u32 initial_count;
|
||||
u32 maximum_count;
|
||||
OSSemaphore* semaphore;
|
||||
} PFK_SEMAPHORE_CONFIG;
|
||||
|
||||
s32 pfk_create_task(PFK_TASK_CONFIG* config);
|
||||
s32 pfk_start_task(s32 task_id);
|
||||
s32 pfk_get_task_id(s32* task_id);
|
||||
s32 pfk_set_task_priority(s32 task_id, s32 priority);
|
||||
s32 pfk_create_mailbox(PFK_MAILBOX_CONFIG* config);
|
||||
s32 pfk_receive_message(s32 mailbox, OSMessage* message);
|
||||
s32 pfk_send_message(s32 mailbox, OSMessage message);
|
||||
s32 pfk_create_semaphore(PFK_SEMAPHORE_CONFIG* config);
|
||||
s32 pfk_delete_semaphore(s32 semaphore);
|
||||
s32 pfk_get_semaphore(s32 semaphore);
|
||||
s32 pfk_release_semaphore(s32 semaphore);
|
||||
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef PF_FA_SYSTEM_LAYOUT_H
|
||||
#define PF_FA_SYSTEM_LAYOUT_H
|
||||
#include <revolution/os.h>
|
||||
|
||||
typedef struct PFSYS_SYSTEM_SET {
|
||||
u32 initialized;
|
||||
s32 task_id;
|
||||
s32 mailbox_id;
|
||||
u8 task_stack[0x2000];
|
||||
OSThread task;
|
||||
OSMessageQueue mailbox;
|
||||
OSMessage messages[20];
|
||||
u32 flock_count;
|
||||
} PFSYS_SYSTEM_SET;
|
||||
|
||||
extern PFSYS_SYSTEM_SET pf_sys_set;
|
||||
#endif
|
||||
@@ -1,96 +0,0 @@
|
||||
#ifndef PF_FA_VOLUME_LAYOUT_H
|
||||
#define PF_FA_VOLUME_LAYOUT_H
|
||||
#define PRFILE2_VFMOD_PF_VOLUME_H
|
||||
#include <private/vf/PrFILE2/fatfs/pf_entry.h>
|
||||
#include <private/vf/PrFILE2/driver/pf_driver.h>
|
||||
#include <private/vf/PrFILE2/fatfs/pf_devinf.h>
|
||||
typedef struct PF_CHARCODE {
|
||||
pf_s32 (*oem2unicode)(const pf_s8*, pf_u16*);
|
||||
pf_s32 (*unicode2oem)(const pf_u16*, pf_s8*);
|
||||
pf_s32 (*oem_char_width)(const pf_s8*);
|
||||
pf_bool (*is_oem_mb_char)(const pf_s8, pf_bool);
|
||||
pf_s32 (*unicode_char_width)(const pf_u16*);
|
||||
pf_bool (*is_unicode_mb_char)(const pf_u16, pf_bool);
|
||||
} PF_CHARCODE;
|
||||
|
||||
typedef struct PF_BPB {
|
||||
pf_u16 bytes_per_sector;
|
||||
pf_u16 num_reserved_sectors;
|
||||
pf_u16 num_root_dir_entries;
|
||||
pf_u8 sectors_per_cluster;
|
||||
pf_u8 num_FATs;
|
||||
pf_u32 total_sectors;
|
||||
pf_u32 sectors_per_FAT;
|
||||
pf_u32 root_dir_cluster;
|
||||
pf_u16 fs_info_sector;
|
||||
pf_u16 backup_boot_sector;
|
||||
pf_u16 ext_flags;
|
||||
pf_u8 media;
|
||||
PF_FAT_TYPE fat_type;
|
||||
pf_u8 log2_bytes_per_sector;
|
||||
pf_u8 log2_sectors_per_cluster;
|
||||
pf_u8 num_active_FATs;
|
||||
pf_u16 num_root_dir_sectors;
|
||||
pf_u32 active_FAT_sector;
|
||||
pf_u32 first_root_dir_sector;
|
||||
pf_u32 first_data_sector;
|
||||
pf_u32 num_clusters;
|
||||
} PF_BPB;
|
||||
|
||||
typedef struct PF_CUR_DIR {
|
||||
pf_u32 stat;
|
||||
pf_s32 context_id;
|
||||
PF_DIR_ENT directory;
|
||||
} PF_CUR_DIR;
|
||||
|
||||
|
||||
typedef pf_s32 (*PF_VOLUME_CB)(pf_s32);
|
||||
struct PF_VOLUME {
|
||||
PF_BPB bpb;
|
||||
pf_u32 num_free_clusters;
|
||||
pf_u32 last_free_cluster;
|
||||
pf_u8 file_and_directory_state[0x1624 - 0x40];
|
||||
PF_SECTOR_CACHE cache;
|
||||
pf_s8 label[12];
|
||||
PF_CUR_DIR current_dir[4];
|
||||
struct {
|
||||
pf_u32 tracker_size;
|
||||
pf_u32 tracker_max;
|
||||
pf_u32* tracker_bits;
|
||||
} tail_entry;
|
||||
pf_s32 last_error;
|
||||
pf_s32 last_driver_error;
|
||||
pf_u32 file_config;
|
||||
pf_u16 flags;
|
||||
pf_s8 drv_char;
|
||||
pf_u16 fsi_flag;
|
||||
PF_CLUSTER_LINK_VOL cluster_link;
|
||||
void* p_part;
|
||||
void (*p_callback)();
|
||||
const pf_u8* format_param;
|
||||
};
|
||||
typedef struct PF_FA_CUR_VOLUME {
|
||||
pf_u32 stat;
|
||||
pf_s32 context_id;
|
||||
PF_VOLUME* p_vol;
|
||||
} PF_FA_CUR_VOLUME;
|
||||
typedef struct PF_VOLUME_SET {
|
||||
pf_u32 flags;
|
||||
pf_u32 reserved;
|
||||
PF_VOLUME* current_volume;
|
||||
PF_FA_CUR_VOLUME context_volumes[3];
|
||||
pf_s32 num_attached_drives;
|
||||
pf_s32 num_mounted_volumes;
|
||||
pf_u32 config;
|
||||
void* param;
|
||||
pf_s32 last_error;
|
||||
pf_s32 last_driver_error;
|
||||
PF_CHARCODE codeset;
|
||||
pf_u32 setting;
|
||||
pf_s32 context_id;
|
||||
pf_u32 context_state[2];
|
||||
struct { pf_u32 stat; pf_s32 context_id; } contexts[3];
|
||||
PF_VOLUME volumes[26];
|
||||
} PF_VOLUME_SET;
|
||||
extern PF_VOLUME_SET pf_vol_set;
|
||||
#endif
|
||||
@@ -1,59 +0,0 @@
|
||||
#ifndef FA_PUH_MSC_H
|
||||
#define FA_PUH_MSC_H
|
||||
|
||||
#include <revolution/fa/types.h>
|
||||
|
||||
typedef struct UHF_MSC_DEVICE {
|
||||
FADisk* disk;
|
||||
u32 device_id;
|
||||
u32 interface_id;
|
||||
u32 endpoint_in;
|
||||
u32 endpoint_out;
|
||||
u32 total_blocks;
|
||||
u32 block_size;
|
||||
u32 tag;
|
||||
u32 lun;
|
||||
u32 flags;
|
||||
u32 status;
|
||||
u32 event;
|
||||
} UHF_MSC_DEVICE;
|
||||
|
||||
typedef struct UHF_MSC_PARAMETERS {
|
||||
UHF_MSC_DEVICE* device;
|
||||
void* sense;
|
||||
u32 timeout;
|
||||
void* buffer;
|
||||
u32 length;
|
||||
u32 sector;
|
||||
u16 transfer_flags;
|
||||
u16 block_count;
|
||||
u32 options;
|
||||
u32 result_size;
|
||||
FADisk* disk;
|
||||
} UHF_MSC_PARAMETERS;
|
||||
|
||||
typedef struct UHF_MSC_MESSAGE {
|
||||
u32 command;
|
||||
s32 semaphore;
|
||||
s32* result;
|
||||
UHF_MSC_PARAMETERS parameters;
|
||||
void (*callback)(void*);
|
||||
void* context;
|
||||
} UHF_MSC_MESSAGE;
|
||||
|
||||
extern UHF_MSC_DEVICE uhg_msc_blk_device_tbl[8];
|
||||
extern s32 uhg_msc_memid_8169971C;
|
||||
s32 uhf_ker_set_priority(s32 task_id, s32 priority);
|
||||
void* uhf_ker_get_memory_block(s32 pool, u32 size, u32 alignment);
|
||||
s32 uhf_ker_release_memory_block(s32 pool, void* block);
|
||||
s32 uhf_ker_create_sem(u32 initial_count, u32 maximum_count);
|
||||
s32 uhf_ker_delete_sem(s32 semaphore);
|
||||
s32 uhf_ker_get_sem(s32 semaphore);
|
||||
s32 uhf_ker_send_message(s32 mailbox, void* message, u32 flags);
|
||||
s32 uhf_ker_check_cacheable(void* buffer);
|
||||
s32 usbh_msc_read10(UHF_MSC_DEVICE* device, u32 sector, u16 count, void* buffer, void* sense);
|
||||
s32 usbh_msc_write10(UHF_MSC_DEVICE* device, u32 sector, u16 count, void* buffer, void* sense);
|
||||
s32 uhf_msc_get_message_id(void);
|
||||
s32 __uhf_msc_cmd_check_sense(const void* sense);
|
||||
|
||||
#endif
|
||||
@@ -7,8 +7,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AXFX_STEREO_CHANNEL_MAX 3
|
||||
|
||||
typedef struct AXFX_BUS {
|
||||
s32* left; // 0x00
|
||||
s32* right; // 0x04
|
||||
@@ -21,13 +19,6 @@ typedef struct AXFX_BUFFERUPDATE {
|
||||
s32* surround; // 0x08
|
||||
} AXFX_BUFFERUPDATE;
|
||||
|
||||
typedef struct AXFX_BUS_DPL2 {
|
||||
s32* left; // 0x00
|
||||
s32* right; // 0x04
|
||||
s32* left_surround; // 0x08
|
||||
s32* right_surround; // 0x0C
|
||||
} AXFX_BUS_DPL2;
|
||||
|
||||
typedef struct AXFX_BUFFERUPDATE_DPL2 {
|
||||
s32* left; // 0x00
|
||||
s32* right; // 0x04
|
||||
|
||||
@@ -49,13 +49,13 @@ typedef struct AXFX_REVERBHI_EXP_DPL2 {
|
||||
f32 crosstalk; // 0x15C
|
||||
f32 earlyGain; // 0x160
|
||||
f32 fusedGain; // 0x164
|
||||
AXFX_BUS_DPL2* busIn; // 0x168
|
||||
AXFX_BUS_DPL2* busOut; // 0x16C
|
||||
AXFX_BUS* busIn; // 0x168
|
||||
AXFX_BUS* busOut; // 0x16C
|
||||
f32 outGain; // 0x170
|
||||
f32 sendGain; // 0x174
|
||||
} AXFX_REVERBHI_EXP_DPL2;
|
||||
|
||||
u32 AXFXReverbHiExpGetMemSizeDpl2(AXFX_REVERBHI_EXP_DPL2* fx);
|
||||
u32 AXFXReverbHiExpGetMemSizeDpl2(const AXFX_REVERBHI_EXP_DPL2* fx);
|
||||
BOOL AXFXReverbHiExpInitDpl2(AXFX_REVERBHI_EXP_DPL2* fx);
|
||||
void AXFXReverbHiExpShutdownDpl2(AXFX_REVERBHI_EXP_DPL2* fx);
|
||||
BOOL AXFXReverbHiExpSettingsDpl2(AXFX_REVERBHI_EXP_DPL2* fx);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user