Skip to content

Commit

Permalink
0.17.9.7
Browse files Browse the repository at this point in the history
  • Loading branch information
armoha committed Oct 14, 2019
2 parents 8430728 + 5d21f2f commit 2baf971
Show file tree
Hide file tree
Showing 11 changed files with 267 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ paket-files/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
Updater/build

# Cake - Uncomment if you are using it
# tools/**
Expand Down
48 changes: 43 additions & 5 deletions EUD Editor/Module/SettingModule.vb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Namespace ProgramSet


'Public Version As String = "vTEST 0.13"
Public Version As String = "0.17.9.1"
Public Version As String = "0.17.9.7"
Public DatEditVersion As String = "v0.3"
Public SCDBSerial As UInteger

Expand Down Expand Up @@ -577,7 +577,33 @@ Namespace ProjectSet


Dim STRpara() As Byte
mem.Position = SearchCHK("STR ", buffer)
Dim entrysize as Integer
entrysize = -1
Try
mem.Position = SearchCHK("STRx", buffer)
entrysize = 4
Catch ex1 As Exception
Try
mem.Position = SearchCHK("STR ", buffer)
entrysize = 2
Catch ex2 As Exception
Throw New System.Exception("String section not found.")
End Try
If mem.Position = 0 Then
Throw New System.Exception("String section not found.")
End If
End Try
If mem.Position = 0 Then
Try
mem.Position = SearchCHK("STR ", buffer)
entrysize = 2
Catch ex2 As Exception
Throw New System.Exception("String section not found.")
End Try
If mem.Position = 0 Then
Throw New System.Exception("String section not found.")
End If
End If

size = binary.ReadUInt32 '문자열 수
STRpara = binary.ReadBytes(size)
Expand All @@ -596,11 +622,23 @@ Namespace ProjectSet
Dim tempstring As String = ""
Dim strcount As Integer = 0

size = strbinary.ReadUInt16
If entrysize = 4 Then
size = strbinary.ReadUInt32
ElseIf entrysize = 2 Then
size = strbinary.ReadUInt16
Else
Throw New System.Exception("Unexpected entry size: " & entrysize)
End If
For i = 0 To size - 1 '문자열 갯수
strmem.Position = 2 + i * 2
strmem.Position = entrysize + (i * entrysize)

tempindex = strbinary.ReadUInt16()
If entrysize = 4 Then
tempindex = strbinary.ReadUInt32()
ElseIf entrysize = 2 Then
tempindex = strbinary.ReadUInt16()
Else
Throw New System.Exception("Unexpected entry size: " & entrysize)
End If

strmem.Position = tempindex

Expand Down
10 changes: 5 additions & 5 deletions EUD Editor/Module/Trigger.vb
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ Public Class Element


'오프셋 구하기.
returnstring = "epdread_epd(EPD(0x5187EC) + " & 3 * _tempvalue(0) & ") + 5 * " & realpos '_tempvalue(1)
returnstring = "btnPtr, btnPos = EPD(0x5187EC) + " & 3 * _tempvalue(0) & ", 5 * " & realpos & ";" '_tempvalue(1)
Return returnstring
Catch ex As Exception
Return returnstring
Expand Down Expand Up @@ -1844,11 +1844,11 @@ Public Class Element
End Try
ElseIf act.Name = "DisplayCText" Then
If Values(1) = "1" Then
_rtext = "txtPtr = dwread_epd_safe(EPD(0x640B58));" & vbCrLf & _rtext & ";" & vbCrLf & "SetMemory(0x640B58, SetTo, txtPtr);"
_rtext = "txtPtr = dwread_epd(EPD(0x640B58));" & vbCrLf & _rtext & ";" & vbCrLf & "SetMemory(0x640B58, SetTo, txtPtr);"
End If
ElseIf act.Name = "DisplaySavedCText" Then
If Values(0) = "1" Then
_rtext = "txtPtr = dwread_epd_safe(EPD(0x640B58));" & vbCrLf & _rtext & ";" & vbCrLf & "SetMemory(0x640B58, SetTo, txtPtr);"
_rtext = "txtPtr = dwread_epd(EPD(0x640B58));" & vbCrLf & _rtext & ";" & vbCrLf & "SetMemory(0x640B58, SetTo, txtPtr);"
End If
ElseIf act.Name = "SetUpgrade" Then
'0"PlayerX",
Expand Down Expand Up @@ -2039,9 +2039,9 @@ Public Class Element
_rtext = "switch(" & Values(0) & ") {"
Case ElementType.Switchcase
If Values(0) = -1 Then
_rtext = " default:"
_rtext = "default:"
Else
_rtext = " case " & Values(0) & ":"
_rtext = "case " & Values(0) & ":"
End If
Case ElementType.Foluder
_rtext = Values(0)
Expand Down
2 changes: 1 addition & 1 deletion EUD Editor/Module/TriggerEditorDataMoudle.vb
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ Module TriggerEditorDataMoudle
End If
strbulider.AppendLine("import tempcustomText as tct;")

strbulider.AppendLine(vbCrLf & "var txtPtr;")
strbulider.AppendLine(vbCrLf & "var txtPtr, btnPtr, btnPos, oldCP;")
strbulider.AppendLine("const trgk = $T('Artanis & safhfh');")

LineCount = strbulider.ToString.Split(vbCrLf).Count
Expand Down
10 changes: 9 additions & 1 deletion EUD Editor/Resources/customText.txt
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ def f_setTbl(tblID, offset, length, *args):
f_settbl2(tblID, offset, *args)


def f_chatAnnouncement(*args):
args = list(args)
for i, arg in enumerate(args):
if isUnproxyInstance(arg, f_s2u):
arg = ptr2s(arg._value)
args[i] = arg
f_eprintln(*args)


def f_chatAnnouncementP(player, *args):
for oldcp in _setcurpl_block(player):
f_eprintln(*args)
Expand All @@ -345,4 +354,3 @@ f_print = _sb.print
f_tblptr = GetTBLAddr
f_getTblPtr = GetTBLAddr
f_printError = f_raise_CCMU
f_chatAnnouncement = f_eprintln
95 changes: 95 additions & 0 deletions Updater/EUDEditorUpdate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# We omitted cryptographic checks intentionally.
# That would be handled properly by https protocol used by GitHub

import atexit
import io
import os
import sys
import zipfile
from threading import Thread
from urllib.error import URLError
from urllib.request import urlopen

import msgbox

VERSION_URL = (
"https://raw.githubusercontent.com/armoha/EUDEditor/master/version/version"
)


def download(url):
try:
with urlopen(url) as urlf:
return urlf.read()
except URLError:
return None


def getLatestVersion():
v = download(VERSION_URL)
if v is None:
return (None, None)
else:
return (v.decode("utf-8")).split("\n")[:2]


def getRelease(url):
return download(url)


def checkUpdate():
# auto update only supports Win32 by now.
# Also, the application should be frozen
if not msgbox.isWindows or not getattr(sys, "frozen", False):
return False

latestVersion, release_url = getLatestVersion()
if latestVersion is None:
return msgbox.MessageBox(
"Update failed", "Fail to get latest version info", textio=sys.stderr
)

# Download the needed data
print("Downloading EUD Editor2 %s" % latestVersion)
release = getRelease(release_url)
if not release:
return msgbox.MessageBox("Update failed", "No release", textio=sys.stderr)

dataDir = os.path.dirname(sys.executable)
updateDir = os.path.join(dataDir, "_update")

with zipfile.ZipFile(io.BytesIO(release), "r") as zipf:
zipf.extractall(updateDir)

# Write an auto-update script. This script will run after euddraft exits
with open(os.path.join(dataDir, "_update.bat"), "w") as batf:
batf.write(
"""\
@echo off
xcopy _update . /e /y /q
rd _update /s /q
del _update.bat /q
"""
)

def onExit():
from subprocess import Popen

Popen("_update.bat")

atexit.register(onExit)


def issueAutoUpdate():
checkUpdateThread = Thread(target=checkUpdate)
checkUpdateThread.start()
# We don't join this thread. This thread will automatically join when
# the whole euddraft process is completed.
#
# Also, we don't want this thread to finish before it completes its update
# process, even if the main thread has already finished. So we don't make
# this thread a daemon thread.


if __name__ == "__main__" or __name__ == "euddraft__main__":
issueAutoUpdate()
70 changes: 70 additions & 0 deletions Updater/msgbox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

"""
Copyright (c) 2014 trgk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""

import ctypes
import sys

try:
from winsound import MB_OK, MB_ICONHAND, MessageBeep

def MessageBox(title, text, style=0, textio=sys.stdout):
print("[%s]\n%s" % (title, text), file=textio)

""" Helper function """
hWnd = ctypes.windll.kernel32.GetConsoleWindow()
ctypes.windll.user32.SetForegroundWindow(hWnd)
ctypes.windll.user32.BringWindowToTop(hWnd)
ctypes.windll.user32.SetForegroundWindow(hWnd)
return ctypes.windll.user32.MessageBoxW(0, text, title, style)

isWindows = True

from ctypes import WINFUNCTYPE, windll, c_int
from ctypes.wintypes import HWND, SHORT

prototype = WINFUNCTYPE(HWND)
GetForegroundWindow = prototype(("GetForegroundWindow", windll.user32))
GetConsoleWindow = prototype(("GetConsoleWindow", windll.kernel32))
prototype = WINFUNCTYPE(HWND, HWND)
SetForegroundWindow = prototype(("SetForegroundWindow", windll.user32))
prototype = WINFUNCTYPE(SHORT, c_int)
GetAsyncKeyState = prototype(("GetAsyncKeyState", windll.user32))

def IsThisForeground():
return GetForegroundWindow() == GetConsoleWindow()


except ImportError:
MB_OK = 1
MB_ICONHAND = 2

def MessageBeep(type):
for _ in range(type):
sys.stdout.write("\a")

def MessageBox(title, text, style=0, textio=sys.stdout):
print("[%s]\n%s\n" % (title, text), file=textio)

isWindows = False
27 changes: 27 additions & 0 deletions Updater/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import sys

from cx_Freeze import Executable, setup

if "build_exe" not in sys.argv:
sys.argv.append("build_exe")


build_exe_options = {
"packages": ["os", "ctypes", "sys"],
"excludes": ["tkinter"],
"optimize": 2,
"include_msvcr": True,
"include_files": [],
"zip_include_packages": "*",
"zip_exclude_packages": "",
"small_app": True,
}


setup(
name="EUD Editor Updater",
version="1.0.0",
description="EUD Editor updating system",
options={"build_exe": build_exe_options},
executables=[Executable("EUDEditorUpdate.py", base="Console")],
)
Binary file removed version/EUD Editor2 0.17.9.1.zip
Binary file not shown.
14 changes: 14 additions & 0 deletions version/PatchNote
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
[ 패치노트 0.17.9.7 ]

- 업데이트 프로그램 교체.
- SetButton이 버튼 변경 안 되는 오류 수정.


[ 패치노트 0.17.9.4 ]

- STR 확장맵 지원 추가.
- RotateLocation 함수 수정.
- ChatAnnouncement에서 tct.s2u 관련 오류 수정.


[ 패치노트 0.17.9.1 ]

- MSQC 마우스 로케이션 UI 최신버전에 맞게 수정.
Expand All @@ -12,6 +25,7 @@
- ct.sprintf, ct.setcachedcp 관련 오류 수정
- punitloop.py 삭제, 표준 함수 사용하게 수정


[ 패치노트 0.17.9.0 ]

- customText이 StringBuffer 사용하게 수정 (1.23.1 패치 대응)
Expand Down
4 changes: 2 additions & 2 deletions version/version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
0.17.9.1
https://github.com/armoha/EUDEditor/raw/master/version/EUD%20Editor2%200.17.9.1.zip
0.17.9.7
https://github.com/armoha/EUDEditor/releases/download/v0.17.9.7/EUD.Editor2.0.17.9.7.zip

0 comments on commit 2baf971

Please sign in to comment.