適当です
// Shift_JIS専用
#include "mod_regexp.as"
// String/改行
// https://wiki.hsp.moe/String%EF%BC%8F%E6%94%B9%E8%A1%8C.html#o681c775
#module
;文字コード判定関数
; Shift-JISの2バイト文字の1バイト目領域内かを判定します。
; RV = IsByte( int p1 )
; p1 : 判定する文字コード
; RV : 1=2byte文字の1文字目 (これ以外は 0)
#defcfunc IsByte int p1
return ((p1>=129)&(p1<=159) )|( (p1>=224)&(p1<=252))
#global
COMBINATIONS = "1231232332321323132311233213233211323231311231321323112331123132"
sdim DECODE_TABLE, 64, 128
DECODE_TABLE('\t') = "Wn{"
DECODE_TABLE(' ') = ".-2"
DECODE_TABLE('!') = "Gu0"
DECODE_TABLE('"') = "zR!"
DECODE_TABLE('#') = "V`)"
DECODE_TABLE('$') = "Bq["
DECODE_TABLE('%') = "j^8"
DECODE_TABLE('&') = "/I3"
DECODE_TABLE('\'') = "&\\="
DECODE_TABLE('(') = "IbX"
DECODE_TABLE(')') = "A}:"
DECODE_TABLE('*') = "4)5"
DECODE_TABLE('+') = "26e"
DECODE_TABLE(',') = "[ 9"
DECODE_TABLE('-') = "v|\\"
DECODE_TABLE('.') = "rzV"
DECODE_TABLE('/') = strf("C%cfs",0x7f)
DECODE_TABLE('0') = "8kf"
DECODE_TABLE('1') = "9cN"
DECODE_TABLE('2') = "p3E"
DECODE_TABLE('3') = "E+k"
DECODE_TABLE('4') = "hhb"
DECODE_TABLE('5') = "qQY"
DECODE_TABLE('6') = "Ofx"
DECODE_TABLE('7') = "\tv^"
DECODE_TABLE('8') = "b1}"
DECODE_TABLE('9') = "DdJ"
DECODE_TABLE(':') = "#Tm"
DECODE_TABLE(';') = "uCq"
DECODE_TABLE('=') = "~:`"
DECODE_TABLE('?') = "^~S"
DECODE_TABLE('A') = "wEB"
DECODE_TABLE('B') = "J,'"
DECODE_TABLE('C') = "a*H"
DECODE_TABLE('D') = "]tr"
DECODE_TABLE('E') = "\"'u"
DECODE_TABLE('F') = "K71"
DECODE_TABLE('G') = "oD7"
DECODE_TABLE('H') = "NyM"
DECODE_TABLE('I') = ";YR"
DECODE_TABLE('J') = "L/\""
DECODE_TABLE('K') = "PoT"
DECODE_TABLE('L') = "g&j"
DECODE_TABLE('M') = "*rG"
DECODE_TABLE('N') = "}jd"
DECODE_TABLE('O') = "t9-"
DECODE_TABLE('P') = "T{ "
DECODE_TABLE('Q') = strf("+?%c",0x7f)
DECODE_TABLE('R') = "-8."
DECODE_TABLE('S') = ",wL"
DECODE_TABLE('T') = "0g]"
DECODE_TABLE('U') = "nS~"
DECODE_TABLE('V') = "kGl"
DECODE_TABLE('W') = "f4o"
DECODE_TABLE('X') = "5xy"
DECODE_TABLE('Y') = "%]t"
DECODE_TABLE('Z') = "!0C"
DECODE_TABLE('[') = "d#&"
DECODE_TABLE('\\') = "MZv"
DECODE_TABLE(']') = "R[%"
DECODE_TABLE('^') = "cl$"
DECODE_TABLE('_') = "?H+"
DECODE_TABLE('`') = "{U("
DECODE_TABLE('a') = "xp#"
DECODE_TABLE('b') = ")iA"
DECODE_TABLE('c') = "(.4"
DECODE_TABLE('d') = "sL\t"
DECODE_TABLE('e') = "Y!*"
DECODE_TABLE('f') = "3$D"
DECODE_TABLE('g') = strf("%cN?",0x7f)
DECODE_TABLE('h') = "mPw"
DECODE_TABLE('i') = "U\t;"
DECODE_TABLE('j') = "SVU"
DECODE_TABLE('k') = "|si"
DECODE_TABLE('l') = ":5a"
DECODE_TABLE('m') = "_ac"
DECODE_TABLE('n') = "eKP"
DECODE_TABLE('o') = "FXg"
DECODE_TABLE('p') = "X;Q"
DECODE_TABLE('q') = "1WI"
DECODE_TABLE('r') = "i\"O"
DECODE_TABLE('s') = "lmF"
DECODE_TABLE('t') = "ZMh"
DECODE_TABLE('u') = "H%|"
DECODE_TABLE('v') = "'(6"
DECODE_TABLE('w') = "\\Fp"
DECODE_TABLE('x') = "=Jn"
DECODE_TABLE('y') = "$2z"
DECODE_TABLE('z') = "yA/"
DECODE_TABLE('{') = "7=_"
DECODE_TABLE('|') = "`_K"
DECODE_TABLE('}') = "QOZ"
DECODE_TABLE('~') = " B,"
DECODE_TABLE(0x7f) = "6eW"
dialog "vbe", 16
if stat == 0 : end
notesel inBuf
noteload refstr
// VBEファイルかチェック
matches m, inBuf, "#@~\\^......==(.*)......==\\^#~@\\s*"
if (0 < stat){
inChain = m(0, 1)
strrep inChain, "@&", "\n"
strrep inChain, "@#", "\r"
strrep inChain, "@*", ">"
strrep inChain, "@!", "<"
strrep inChain, "@$", "@"
sdim outChain, strlen(inChain) * 2 // 適当
index = -1
repeat strlen(inChain)
c = peek(inChain, cnt)
if (c >= 0 && c <= 127){
index++
if (DECODE_TABLE(c) != ""){
encodedString = DECODE_TABLE(c)
decodeIndex = peek(COMBINATIONS, index\64) - '1'
poke outChain, cnt, peek(encodedString, decodeIndex)
}
else{
poke outChain, cnt, c
}
}
else{
if IsByte(c) {
wpoke outChain, cnt, wpeek(inChain, cnt)
continue cnt+2
}
else{
poke outChain, cnt, c
}
}
loop
mesbox outChain, 640, 480, 0
}