SetfsbHeader.as [SetFSBヘッダスクリプト]
;*******************************************************************************
; SetFSB hedder for HSP3.1 [2007.09.20]
; Value & Constance, Windows API, macro and function
; Programmed in HSP Ver3.1 ONION software (http://hsp.tv/)
; Copyright (C) 2007 by abo, all rights reserved.
;*******************************************************************************
#ifdef __hsp30__
#ifndef __SETFSBHEADER__
#define global __SETFSBHEADER__
;/ Value & Constance
;--------+---------+---------+---------+---------+---------+---------+---------+
#include "sysval.as" ;System Value [stdlib]
#include "gblconst.as" ;Global Constance [stdlib]
#include "chipconst.as" ;Chipset Constance
;/ Windows API
;--------+---------+---------+---------+---------+---------+---------+---------+
#include "kernel32.as" ;KERNEL32.DLL
#include "user32.as" ;USER32.DLL
#include "gdi32.as" ;GDI32.DLL
#include "advapi32.as" ;ADVAPI32.DLL
#include "winmm.as" ;WINMM.DLL
#include "comctl32.as" ;COMCTL32.DLL
#uselib "KERNEL32.DLL"
/* --- for sysinfo.as --- */
#define global _CreateFile _CreateFileA
#cfunc global _CreateFileA "CreateFileA" sptr,sptr,sptr,sptr,sptr,sptr,sptr
#cfunc global _GetLastError "GetLastError"
#uselib "USER32.DLL"
/* --- for exobject.as --- */
#define global _LoadCursor _LoadCursorA
#cfunc global _LoadCursorA "LoadCursorA" sptr,sptr
#define global _GetWindowLong _GetWindowLongA
#cfunc global _GetWindowLongA "GetWindowLongA" sptr,sptr
/* --- for Screen Capture module --- */
#cfunc global _GetDC "GetDC" sptr
/* --- for SetFSB.hsp --- */
#cfunc global _GetFocus "GetFocus"
#uselib "GDI32.DLL"
/* --- for Screen Capture module --- */
; #define global _CreateDC _CreateDCA screencapture
; #cfunc global _CreateDCA "CreateDCA" sptr,sptr,sptr,sptr
/* --- for exobject.as --- */
#define global _CreateFontIndirect _CreateFontIndirectA
#cfunc global _CreateFontIndirectA "CreateFontIndirectA" sptr
#uselib "ADVAPI32.DLL"
/* --- for sysinfo.as --- */
#define global _CreateService _CreateServiceA
#cfunc global _CreateServiceA "CreateServiceA" sptr,sptr,sptr,sptr,sptr,sptr,sptr,sptr,sptr,sptr,sptr,sptr,sptr
#define global _OpenSCManager _OpenSCManagerA
#cfunc global _OpenSCManagerA "OpenSCManagerA" sptr,sptr,sptr
#define global _OpenService _OpenServiceA
#cfunc global _OpenServiceA "OpenServiceA" sptr,sptr,sptr
#uselib "WINMM.DLL"
/* --- for cpufreq.as --- */
#cfunc global _timeGetTime "timeGetTime"
;--------+---------+---------+---------+---------+---------+---------+---------+
; macros and functions
;--------+---------+---------+---------+---------+---------+---------+---------+
;/ Virtual Protect macro
#const global PAGE_NOACCESS 0x0001
#const global PAGE_READONLY 0x0002
#const global PAGE_READWRITE 0x0004
#const global PAGE_WRITECOPY 0x0008
#const global PAGE_EXECUTE 0x0010
#const global PAGE_EXECUTE_READ 0x0020
#const global PAGE_EXECUTE_READWRITE 0x0040
#const global PAGE_EXECUTE_WRITECOPY 0x0080
#const global PAGE_GUARD 0x0100
#const global PAGE_NOCACHE 0x0200
#const global PAGE_WRITECOMBINE 0x0400
#define global xdim(%1,%2) dim %1,%2 :\
VirtualProtect varptr(%1), %2*4, PAGE_EXECUTE_READWRITE, varptr(fOldProtect@)
;/ Sysinfo Definition
#define global sysinfo_os sysinfo(0)
;/ Constance Definition
#define global NULL 0
#define global FALSE 0
#define global TRUE 1
;#define global MAX_PATH 260
#define global PI 3.14159265358979323846 ; π
#define global RGBblack 0x000000
#define global RGBblue 0xFF0000
#define global RGBred 0x0000FF
;/ 32bit Integer(word/byte) ctype macro
#define global ctype LOWORD(%1) (%1&0xFFFF)
#define global ctype HIWORD(%1) (%1>>16&0xFFFF)
#define global ctype MAKELONG(%1,%2) (%1&0xFFFF|(%2<<16&0xFFFF0000))
#define global ctype HIBYTE(%1) (%1>>8&0xFF)
#define global ctype LOBYTE(%1) (%1&0xFF)
#define global ctype MAKEWORD(%1,%2) (%1&0xFF|(%2<<8&0xFF00))
#define global ctype NOTB(%1) (%1^$FFFFFFFF)
#define global ctype HISWORD(%1) (%1>>16)
#define global ctype LOSWORD(%1) (%1<<16>>16)
#define global ctype HISBYTE(%1) (%1<<16>>24)
#define global ctype LOSBYTE(%1) (%1<<24>>24)
#define global ctype CND(%1,%2,%3) ((%2)*((%1)!=0)|(%3)*((%1)==0))
#define global ctype NOTL(%1) ((%1)==0)
#define global ctype MIN(%1,%2) (%1*(%1<=%2)|%2*(%1>%2))
#define global ctype MAX(%1,%2) (%1*(%1>=%2)|%2*(%1<%2))
#define global ctype SGN(%1) (((%1)>0) - ((%1)<0))
#define global ctype ISTRUE(%1) (%1!=0)
#define global ctype ISFALSE(%1) (%1==0)
#define global ctype RGB(%1,%2,%3) ((%3<<16&$FF0000)|(%2<<8&$FF00)|(%1&$FF))
#define global ctype GETRVALUE(%1) (%1&$ff)
#define global ctype GETGVALUE(%1) (%1>>8&$ff)
#define global ctype GETBVALUE(%1) (%1>>16&$ff)
;/ string ctype macro
#define global ctype HEX(%1) int("$"+(%1))
#define global ctype STRBIN(%1) str((%1)>>7&1)+str((%1)>>6&1)+str((%1)>>5&1)+str((%1)>>4&1)+str((%1)>>3&1)+str((%1)>>2&1)+str((%1)>>1&1)+str((%1)&1)
#define global ctype BIN(%1) CND(strlen(%1)<1,0,int(strmid(%1,strlen(%1)-1,1)))+CND(strlen(%1)<2,0,int(strmid(%1,strlen(%1)-2,1))*2)+CND(strlen(%1)<3,0,int(strmid(%1,strlen(%1)-3,1))*4)+CND(strlen(%1)<4,0,int(strmid(%1,strlen(%1)-4,1))*8)+CND(strlen(%1)<5,0,int(strmid(%1,strlen(%1)-5,1))*16)+CND(strlen(%1)<6,0,int(strmid(%1,strlen(%1)-6,1))*32)+CND(strlen(%1)<7,0,int(strmid(%1,strlen(%1)-7,1))*64)+CND(strlen(%1)<8,0,int(strmid(%1,strlen(%1)-8,1))*128)
;/ 64bit Integer ctype macro
; 64bit整数の加算を行う p1+p2
#define global ctype LLADD(%1,%2) \
(%1+%2),(%1(1)+%2(1)+(%1<0^%2<0)*(%1+%2>=0)+(%1<0)*(%2<0))
; 64bit整数の減算を行う p1-p2
#define global ctype LLSUB(%1,%2) \
(%1-%2),(%1(1)-%2(1)-(%1>>31=%2>>31)*(%1-%2<0)-(%1>=0)*(%2<0))
; 符号付き32bit整数を64bit整数に変換する
#define global ctype ITOLL(%1) (%1),(%1>>31)
; 64bit整数をコピーする
#define global ctype LLCOPY(%1) (%1),(%1(1))
;/ double precision floating point ctype macro
; 倍精度浮動小数点数(p1)を64bit整数(戻り値)へ変換する
#define global ctype DTOLL(%1) (int(%1)),(int(%1/0x10000/0x10000)-(%1<0))
; 64bit整数(p1)を倍精度浮動小数点数(戻り値)へ変換する
#define global ctype LLTOD(%1) (double(%1(1))*0x10000*0x10000+double(HIWORD(%1))*0x10000+double(LOWORD(%1)))
;/ Screen Capture module
#module "capture"
;--------+---------+---------+---------+---------+---------+---------+---------+
; screencapture p1,p2,p3,p4,p5,p6
; p1,p2=offset x,y : p3,p4=size x,y : p5,p6=pos x,y
;--------+---------+---------+---------+---------+---------+---------+---------+
#define SRCCOPY 0x00CC0020 ;転送元から転送先へそのままコピーする
#deffunc screencapture int p1, int p2, int p3, int p4, int p5, int p6
buffer 1,p3,p4 : wait 10
hScrDC = _GetDC(0) ;or hScrDC = _CreateDC("DISPLAY",0,0,0)
BitBlt hdc, p1, p2, p3, p4, hScrDC, p5, p6, SRCCOPY
ReleaseDC 0, hScrDC
redraw 1
return
#global
#endif ; __SETFSBHEADER__
#endif ; __hsp30__
;--------------------------------------------------------------- (EOF) ---------