Skip to content

Adult titles

The games this site covers are adult titles. Their data, pictures and text include sexual content.

Continue only if you are an adult where you live.

0x2c7 byte-substring

Opcode 0x2c7 (711), compute. Investigated by OME, with high confidence (from investigation).

(out)(string)(start)(count) — native's SBSubstr: copy count bytes of the string from byte start, kept from splitting a double-byte character. A start at or past the end, or a count below 1, gives the empty string.

Operands

#RoleTypes seenAccess
1destinationl-strwrite-string
2source stringl-str, l-str-ptrread-string
3first byteimm, l-intread
4byte countimm, l-intread

In the port

OME’s port implements it. It never waits: a wait parks the engine until input, a sleep, a transition, a dialog or a movie ends. What it can do with control besides waiting:

  • falls: it returns to the next instruction

OME derives these facts from the port’s handler (its tools/opcode_flow.py), and they over-approximate: a fact some path can reach is given.

By build

Whether each build’s scripts use it, as OME’s survey of the game’s scripts saw them, and how many evidence items name the build.

BuildGameUsed by its scriptsEvidence
4.24J (SYS4422)Himegari Dungeon Meisterno1
4.33G (SYS4433)Kamidori Alchemy Meisterno1
4.38D (SYS4438)Soukoku no Arterialyes1

Evidence

  • native-re on SYS4433, SYS4422, high confidence; Kamidori SYS4433 Ghidra /kamidori/4.33G and Himegari SYS4422 Ghidra /v2 (vm-map/opcodes.toml opcode 0x2c7): op_0x2c7_plain_byte_substring@0x42d220 (4.33G) and @0x42c2f0 (4.24J) copy operand 2 into a std::string and call std::string substr(operand 3, operand 4) (std_string_substr@0x425190 / @0x419f00), then write the result to operand 1. std_string_assign_substr_checked@0x40a940 throws out_of_range (invalid string position) when the start is above the size, unsigned, and clamps the count to the rest. engine_main_tick_sys4433@0x411a40 catches Command_Exit_Exception, Command_ShowMessage_Exception, Command_Type_Exception, SE_Exception and BadAlloc_Exception only (FuncInfo 0x5aed2c), and its caller 0x48f0f0 has one catch-all, around a command's delete, so an out_of_range ends the program.
  • native-re on SYS4438, high confidence; Arterial SYS4438 Ghidra /arterial/4.38D and the complete Arterial catalog (vm-map/opcodes.toml opcode 0x2c7): op_0x2c7_byte_substring@0x42fe10 reads the string (operand 2), the start (3) and the count (4). When the start, compared unsigned, is below the byte length and the count is above 0, it walks the bytes before the start: if the last one is the first byte of a double-byte character (0x81 to 0x9f, or 0xe0 up, and not itself a second byte), it traces 「関数:SBSubstr 警告:文字列が全角文字の途中から切り出されるため、先頭バイトを切り捨てました。」, moves the start one byte on and takes one from the count. It walks to start + count the same way: if that last byte is the first of a double-byte character, it traces 「…切り出した文字列が全角文字の途中で終了するため、最終バイトを切り捨てました。」 and takes one from the count. Then it writes substr(start, count) to operand 1; otherwise it writes the empty string.

Details

OME’s notes on it, as the registry keeps them.

The port matches (Cp932Text.ByteSubstring) and reports each of native's two traces as a warning. 創刻のアテリアル has 14 sites. 4.24J's and 4.33G's handler at this number is std::string's substr of the bytes, with no care for double-byte characters: the count is unsigned, so a negative one takes the rest, and a start past the byte length throws out_of_range, which no handler catches, so the program ends. The port follows each build (TextRules.SubstringKeepsDoubleByteCharacters, Cp932Text.PlainByteSubstring): a cut keeps the lone byte, and a start past the end halts the run (string-position). SYS4422's and SYS4433's tables lack the opcode, as no script of Himegari or Kamidori has a site (docs/engine-re.md, 'Kamidori against Arterial, triaged').