/*
 *	clipafxb.h
 *
 *	AfterEffects傾僯儊乕僔儑儞僔乕働儞僒(僶僀僫儕宍幃)
 *
 *	CLiP - Common Library for P/ECE
 *	Copyright (C) 2016 Naoyuki Sawa
 *
 *	* Thu Apr 28 21:03:22 JST 2016 Naoyuki Sawa
 *	- 1st 儕儕乕僗丅
 *	* Sat Apr 30 21:45:42 JST 2016 Naoyuki Sawa
 *	- AfxBin_Load(),AfxBin_Draw()傪捛壛偟傑偟偨丅
 *	* Mon May 02 21:51:14 JST 2016 Naoyuki Sawa
 *	- 僶僀僫儕宍幃偺傾僯儊乕僔儑儞僼傽僀儖偱偼丄ST_AfxSeq.layers[],媦傃,ST_AfxLyr.pAfxSeq偵丄僆僼僙僢僩傪奿擺偡傞傛偆偵偟傑偟偨丅
 *	  偙傟傑偱偼曄姺帪偺億僀儞僞傪偦偺傑傑奿擺偟偰偍傝丄儘乕僪帪偵忋彂偒偡傞偺偱摦嶌忋偼栤戣柍偄傕偺偺柍懯側丄忣曬偲側偭偰偄傑偟偨丅
 *	- 僆僼僙僢僩傪奿擺偡傞傛偆偵偟偨帠偵傛傝丄AfxBin_Load()偵偍偄偰丄忋婰偺僼傿乕儖僪傪億僀儞僞偵彂偒姺偊傞昁梫偑柍偔側傝傑偟偨丅
 *	  AfxBin_Draw()偱偼丄僆僼僙僢僩偐傜僣儕乕傪扝偭偰偄偗傞偐傜偱偡丅
 *	- 偙偺傛偆偵曄峏偟偨棟桼偼丄崱屻丄僶僀僫儕宍幃偺傾僯儊乕僔儑儞僼傽僀儖傪ROM壔偟偨偄偲巚偭偰偄傞偐傜偱偡丅
 *	  崱偼傑偩AfxBin_Load()偑ST_AfxLyr.footage傪彂偒姺偊偰偄傞偺偱ROM壔弌棃側偄偺偱偡偑丄崱屻壗偲偐岺晇偟偰傒偨偄偲巚偭偰偄傑偡丅
 *	  崱夞偺曄峏偼丄偦偺偨傔偺堦曕偱偡丅
 *	* Thu May 05 21:24:20 JST 2016 Naoyuki Sawa
 *	- ROM壔弌棃傞傛偆偵側傝傑偟偨丅
 *	  AfxBin_Draw()偑丄僼傽僀儖僀儊乕僕傪偦偺傑傑張棟弌棃傞傛偆偵側傝傑偟偨丅
 *	  偦傟偵敽偭偰丄AfxBin_Load()偼晄梫偵側偭偨偺偱丄嶍彍偟傑偟偨丅
 *	- AfxBin_ClearFrameCache()傪捛壛偟傑偟偨丅
 *	  AfxBin_Load()傪嶍彍偟偨偙偲偵傛傝丄僼儗乕儉僉儍僢僔儏傪僋儕傾偡傋偒僞僀儈儞僌傪丄摉儌僕儏乕儖偑敾掕偡傞帠偑弌棃側偔側偭偨偐傜偱偡丅
 *	  徻嵶偼丄clipafxb.c撪偺丄AfxBin_ClearFrameCache()娭悢撪偺僐儊儞僩傪嶲徠偟偰壓偝偄丅
 *	- USE_AFXBIN_COMPRESS傪掕媊偟側偗傟偽丄AfxBin_Compress_*()傪娷傔側偄傛偆偵偟傑偟偨丅
 *	  USE_AFXBIN_EXPAND傪掕媊偟側偗傟偽丄AfxBin_Expand()傪娷傔側偄傛偆偵偟傑偟偨丅
 *	  P/ECE偱偼儊儌儕愡栺偺偨傔偵丄偙傟傜偺娭悢傪娷傔側偄傛偆偵偟傑偟偨(娷傔傞帠傕壜擻偱偼偁傝傑偡)丅
 *	- AfxBin_DrawNo()傪捛壛偟傑偟偨丅
 *	- 崱夞偺曄峏偱丄摉儌僕儏乕儖偺婡擻偼傎傏姰惉偟偨偲巚偄傑偡丅
 *	  偨偩偟丄埲壓偺栤戣偑巆偭偰偄傑偡丅
 *	  亊clipafxs.h偲clipafxb.h偺儌僕儏乕儖暘偗偑彮乆榗偱偁傞丅
 *	  亊AfxBin_Draw()偑ST_AfxSeq峔憿懱傪僼傿乕儖僪偺堄枴傪撉傒懼偊偰巊梡偟偰偍傝晄帺慠側幚憰偱偁傞丅
 *	  偄偢傟傕摦嶌忋偺栤戣偼柍偄偺偱偡偑丄彮乆敾傝恏偄偱偡丅
 *	  傑偢偼摦嶌専徹傪桪愭偟偰丄摦嶌偑埨掕偟偨屻偱丄忋婰偺廋惓傪専摙偟傛偆偲巚偄傑偡丅
 *	* Fri May 06 21:58:10 JST 2016 Naoyuki Sawa
 *	- AfxBin_Draw_GetFootage()傪捛壛偟傑偟偨丅
 *	  徻嵶偼丄乽巊梡椺乿傪嶲徠偟偰壓偝偄丅
 *	* Tue May 10 22:06:16 JST 2016 Naoyuki Sawa
 *	- 婛懚偺娭悢AfxSeqNo_GetAfxSeq()傪丄張棟撪梕偼偦偺傑傑偱AfxBin_GetNo()偵柤慜曄峏偟丄儘乕僇儖娭悢佀僌儘乕僶儖娭悢偵曄峏偟傑偟偨丅
 *	  忋婰偺曄峏傪峴偭偨棟桼偼丄傾僾儕働乕僔儑儞偑ST_AfxSeq峔憿懱(偺僶僀僫儕宍幃)傪嶲徠偟偰丄捈愙僩儔僶乕僗偟偰條乆側忣曬傪庢摼偟偨偄働乕僗偑桳傞偐傜偱偡丅
 *	  偪側傒偵埲慜丄clipanms.c儌僕儏乕儖傗clipncss.c儌僕儏乕儖偱傕摨條偺梫審偑桳傝丄偦偺帪偼忣曬庢摼梡偺屄暿偺娭悢(AnmSeqNo_GetLen,NcsSeqNo_GetLen)傪愝偗偨偺偱偡偑丄
 *	  ST_AfxSeq峔憿懱偺応崌偼忣曬偺庬椶偑懡偄偺偱丄忣曬庢摼梡偺屄暿偺娭悢傪戲嶳捛壛偡傞傛傝傕丄ST_AfxSeq峔憿懱傪捈愙曉偡曽偑椙偄偲巚偄丄偙偺傛偆偵曄峏偡傞帠偵偟傑偟偨丅
 *	  clipanms.c儌僕儏乕儖傗clipncss.c儌僕儏乕儖偺懳墳曽朄偲丄摉儌僕儏乕儖偺懳墳曽朄偵丄摑堦惈偑柍偄偺偼丄忋婰偺棟桼偵傛傞傕偺偱偡丅
 *	* Thu May 12 22:56:34 JST 2016 Naoyuki Sawa
 *	- ST_AfxBin_Draw_GetFootage_Param._SprNo_Max傪嶍彍偟傑偟偨丅
 *	  clipenm.c儌僕儏乕儖偵EnmDef_GetMax()摍傪捛壛偟偨帠偵傛偭偰楍嫇宆偺嵟戝抣偑幚峴帪偵庢摼弌棃傞傛偆偵側偭偨偺偱丄傾僾儕働乕僔儑儞偐傜搉偡昁梫偼柍偔側偭偨偐傜偱偡丅
 *	* Tue May 17 21:36:02 JST 2016 Naoyuki Sawa
 *	- AfxBin_Draw_GetFootage()偺張棟傪曄峏偟傑偟偨丅
 *	  Windows娐嫬偱偼儊儌儕偵梋桾偑桳傞偺偱丄僼僢僥乕僕偺慺嵽僼傽僀儖柤偐傜丄僗僾儔僀僩(枖偼僥僋僗僠儍)斣崋傊偺曄姺寢壥傪丄僉儍僢僔儏偡傞帠偵偟傑偟偨丅
 *	  寢壥偼曄傢傝傑偣傫丅
 *	* Mon May 23 22:46:16 JST 2016 Naoyuki Sawa
 *	- ST_AfxSeq峔憿懱偲ST_AfxLyr峔憿懱偵丄name僼傿乕儖僪傪捛壛偟傑偟偨丅
 *	  捛壛偟偨棟桼偼丄崱屻僐儞億僕僔儑儞傗儗僀儎偺嵎偟懼偊傪峴偆応崌偵丄幚峴帪偵柤慜偺忣曬偑昁梫偵側傞偲巚偭偨偐傜偱偡丅
 *	  尰帪揰偱偼傑偩丄捛壛偟偨name僼傿乕儖僪傪棙梡偟偰偄傑偣傫偑丄崱屻棙梡偡傞梊掕偱偡丅	佀{{2016/05/23捛婰:懳墳偟傑偟偨丅}}
 *	- 忋婰偺曄峏偵敽偄丄clipafxs.c,媦傃,clipafxb.c偺僐乕僪傪丄戝暆偵曄峏偟傑偟偨丅
 *	  傾僾儕働乕僔儑儞偺娤揰偱曄傢偭偨揰偼丄fnLoad娭悢傊偺僐儞億僕僔儑儞柤偺堷偒搉偟偑丄屄暿偺娭悢堷悢偱偼側偔丄pAfxSeq->name宱桼偱嶲徠偡傞傛偆偵側偭偨揰偺傒偱偡丅
 *	* Mon May 23 23:04:00 JST 2016 Naoyuki Sawa
 *	- 捛壛偟偨name僼傿乕儖僪傪丄傾僾儕働乕僔儑儞偑棙梡偡傞偨傔偺巇慻傒傪捛壛偟傑偟偨丅
 *	  1. 摉儌僕儏乕儖偺昤夋娭悢偵丄fnFilter堷悢傪捛壛偟傑偟偨丅傾僾儕働乕僔儑儞掕媊偺僼傿儖僞娭悢傪巜掕偡傞帠偱丄僩儔僶乕僗張棟偵妱傝崬傫偱僐儞億僕僔儑儞扨埵偺嵎偟懼偊偑壜擻偱偡丅
 *	  2. 傾僾儕働乕僔儑儞掕媊偺fnDraw娭悢偵丄layerDepth,layerPath堷悢傪捛壛偟傑偟偨丅傾僾儕働乕僔儑儞掕媊偺fnDraw娭悢偺拞偱偙傟傜偺忣曬傪嶲徠偟偰丄昤夋捈慜偱偺嵎偟懼偊偑壜擻偱偡丅
 *	- 傑偩丄忋婰偺巇慻傒偺巊梡椺傪彂偄偰偄傑偣傫丅	仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仼仸TODO:
 *	* Fri May 27 23:20:42 JST 2016 Naoyuki Sawa
 *	- AfxBin_Dump()傪捛壛偟傑偟偨丅
 *	  USE_AFXBIN_DUMP傪掕媊偟側偗傟偽丄AfxBin_Dump()傪娷傔側偄傛偆偵偟傑偟偨丅
 *	* Sat May 28 21:20:19 JST 2016 Naoyuki Sawa
 *	- AfxBin_Dump()傪巊偭偰丄/clip/tool/dpafxbin/ 偵'僟儞僾儌乕僪'傪捛壛偟傑偟偨丅
 *	  徻嵶偼丄/clip/tool/dpafxbin/app.c 傪嶲徠偟偰壓偝偄丅
 *	  摉儌僕儏乕儖偺僐乕僪偵偼曄峏桳傝傑偣傫丅
 *	* Mon Aug 15 21:37:25 JST 2016 Naoyuki Sawa
 *	- clipenm.c偵EnmDef_GetVal_UseCompar()傪捛壛偟偨帠偵敽偄丄AfxBin_Draw_GetFootage()撪偺僼僢僥乕僕偺専嶕張棟偵丄EnmDef_GetVal_UseCompar()傪巊梡偡傞傛偆偵曄峏偟傑偟偨丅
 *	  摦嶌寢壥偵偼曄峏桳傝傑偣傫丅
 *	* Fri Sep 09 20:41:26 JST 2016 Naoyuki Sawa
 *	- P/ECE偵壛偊偰丄Win64偱傕AfxBin_Compress_*(),AfxBin_Expand()偼枹懳墳偵偟傑偟偨丅
 *	  偙傟傜偺娭悢偼億僀儞僞偑32價僢僩偱偁傞帠偵嫮偔埶懚偟偰偍傝丄64價僢僩娐嫬偱傕摦嶌偡傞傛偆偵曄峏偡傞帠偑崲擄偩偐傜偱偡丅
 *	  偙傟傜偺娭悢偼32價僢僩娐嫬偱嶌惉偟偨僣乕儖偱偟偐巊梡偟側偄偺偱丄64價僢僩娐嫬偱巊偊側偔偰傕栤戣桳傝傑偣傫丅
 *	* Fri Sep 09 21:13:53 JST 2016 Naoyuki Sawa
 *	- 64價僢僩娐嫬偱AfxBin_Draw()傪巊梡弌棃傞傛偆偵偡傞偨傔偵丄32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱偲偟偰ST_AfxBinLyr,ST_AfxBin傪捛壛偟傑偟偨丅
 *	  曄峏傪峴偭偨棟桼偼丄埲壓偺捠傝偱偡丅
 *	- 偙傟傑偱偼丄僶僀僫儕宍幃傪埖偆娭悢偱偼丄ST_AfxLyr,ST_AfxSeq峔憿懱偺億僀儞僞宆僼傿乕儖僪傪惍悢僼傿乕儖僪偲尒側偟偰巊梡偟偰偄傑偟偨丅
 *	  偙偆側偭偰偄傞棟桼偼昁慠偱偼側偔丄嵟弶偵clipafxs.c傪幚憰偟偨屻偱丄巚偄晅偒偱clipafxb.c傪幚憰偟偨嵺偺惉傝峴偒偱偙偆側偭偰偄偨傕偺偱丄杮摉偼朷傑偟偔偁傝傑偣傫偱偟偨丅
 *	  朷傑偟偄幚憰曽朄偱偼側偄偺偱偡偑丄32價僢僩斉偱偼摦嶌忋偼栤戣側偐偭偨偺偱丄偦偺傑傑偵偟偰偄傑偟偨丅
 *	- 偟偐偟丄64價僢僩斉偱偼丄億僀儞僞宆偲惍悢宆偺僒僀僘偑堎側傞偨傔丄亀dpafxbin.exe亁偱嶌惉偟偨僨乕僞傪撉傒崬傫偱巊梡偟傛偆偲偡傞偲丄峔憿懱僒僀僘偑堘偭偰巊梡弌棃側偄栤戣偑惗偠傑偟偨丅
 *	  偦偺偨傔丄柧帵揑偵僶僀僫儕宍幃傪昞偡峔憿懱傪掕媊偡傞昁梫偑惗偠傑偟偨丅
 *	- 忋婰偺捠傝丄崱夞偺曄峏偼丄64價僢僩懳墳偺偨傔偵昁梫偲側偭偨傕偺偱偡丅
 *	  32價僢僩斉偼偙傟傑偱偺傑傑偱傕峔傢側偄偺偱偡偑丄32價僢僩斉偵偍偄偰傕柧帵揑偵僶僀僫儕宍幃傪昞偡峔憿懱傪巊梡偡傞曽偑朷傑偟偄帠偲丄32價僢僩斉偲64價僢僩斉偱僐乕僪傪嫟捠壔偟偨偄偺偱丄32價僢僩斉偵傕崱夞偺曄峏傪揔梡偡傞帠偵偟傑偟偨丅
 *	  32價僢僩斉偺娤揰偐傜偼丄億僀儞僞宆僼傿乕儖僪傪惍悢偵僉儍僗僩偡傞張棟偑晄梫偵側偭偨偩偗偱偁傝丄撪晹張棟偲偟偰偼曄傢偭偰偄傑偣傫丅
 *	- (int)抣傪(void*)偵僉儍僗僩偟偰惍悢僨乕僞偲偟偰巊梡偡傞売強偱丄64價僢僩斉偱偼僐儞僷僀儔偺寈崘偑弌偰偄偨栤戣傪夞旔偟傑偟偨丅
 *	  徻嵶偼丄AfxBin_Draw_GetFootage()撪偺僐儊儞僩傪嶲徠偟偰壓偝偄丅
 */
#ifndef __CLIP_AFXB_H__
#define __CLIP_AFXB_H__
#ifdef  __cplusplus
extern "C" {
#endif//__cplusplus
#ifndef PIECE
  #define USE_AFXBIN_COMPRESS	//AfxBin_Compress_*()傪巊梡偡傞応崌偼丄偙偺僔儞儃儖傪掕媊偟偰壓偝偄丅	P/ECE偱偼巊梡偟側偄偲巚偆偺偱儊儌儕愡栺偺偨傔偵奜偡帠偵偟傑偟偨(娷傔傞帠傕壜擻偱偼偁傝傑偡)丅	Windows偱傕僣乕儖偱偟偐巊梡偟傑偣傫偑梕検偺惂栺偑彮側偄偺偱忢偵娷傔偰偍偔帠偵偟傑偟偨丅
  #define USE_AFXBIN_EXPAND	//AfxBin_Expand()傪巊梡偡傞応崌偼丄偙偺僔儞儃儖傪掕媊偟偰壓偝偄丅	P/ECE偱偼巊梡偟側偄偲巚偆偺偱儊儌儕愡栺偺偨傔偵奜偡帠偵偟傑偟偨(娷傔傞帠傕壜擻偱偼偁傝傑偡)丅	Windows偱傕幚峴帪偵偼傑偢巊梡偟側偄偲巚偄傑偡偑梕検偺惂栺偑彮側偄偺偱忢偵娷傔偰偍偔帠偵偟傑偟偨丅
  #define USE_AFXBIN_DUMP	//AfxBin_Dump()傪巊梡偡傞応崌偼丄偙偺僔儞儃儖傪掕媊偟偰壓偝偄丅		P/ECE偱偼巊梡偟側偄偲巚偆偺偱儊儌儕愡栺偺偨傔偵奜偡帠偵偟傑偟偨(娷傔傞帠傕壜擻偱偼偁傝傑偡)丅	Windows偱傕僣乕儖偱偟偐巊梡偟傑偣傫偑梕検偺惂栺偑彮側偄偺偱忢偵娷傔偰偍偔帠偵偟傑偟偨丅
#endif//PIECE
//{{2016/09/09捛壛:P/ECE偵壛偊偰丄Win64偱傕AfxBin_Compress_*(),AfxBin_Expand()偼枹懳墳偵偟傑偟偨丅偙傟傜偺娭悢偼億僀儞僞偑32價僢僩偱偁傞帠偵嫮偔埶懚偟偰偍傝丄64價僢僩娐嫬偱傕摦嶌偡傞傛偆偵曄峏偡傞帠偑崲擄偩偐傜偱偡丅偙傟傜偺娭悢偼32價僢僩娐嫬偱嶌惉偟偨僣乕儖偱偟偐巊梡偟側偄偺偱丄64價僢僩娐嫬偱巊偊側偔偰傕栤戣桳傝傑偣傫丅
#ifdef  _WIN64
#undef  USE_AFXBIN_COMPRESS	//劍P/ECE偵壛偊偰丄Win64偱傕AfxBin_Compress_*(),AfxBin_Expand()偼枹懳墳偵偟傑偟偨丅偙傟傜偺娭悢偼億僀儞僞偑32價僢僩偱偁傞帠偵嫮偔埶懚偟偰偍傝丄64價僢僩娐嫬偱傕摦嶌偡傞傛偆偵曄峏偡傞帠偑崲擄偩偐傜偱偡丅偙傟傜偺娭悢偼32價僢僩娐嫬偱嶌惉偟偨僣乕儖偱偟偐巊梡偟側偄偺偱丄64價僢僩娐嫬偱巊偊側偔偰傕栤戣桳傝傑偣傫丅
#undef  USE_AFXBIN_EXPAND	//劊彯丄AfxBin_Dump()傕捠忢偺傾僾儕働乕僔儑儞偵偼晄梫側偺偱偡偑丄AfxBin_Compress_*(),AfxBin_Expand()偲堘偭偰億僀儞僞偑32價僢僩偱偁傞帠偵嫮偔埶懚偟偰偄傞栿偱偼柍偄偺偱丄AfxBin_Dump()偼64價僢僩娐嫬偱傕桳岠偵偟偰偍偔帠偵偟傑偟偨丅P/ECE娐嫬偲偼堘偭偰丄Win64娐嫬偵偍偄偰偼儊儌儕愡栺偼偝傎偳廳梫偱偼側偄偐傜偱偡丅
#endif//_WIN64
//}}2016/09/09捛壛:P/ECE偵壛偊偰丄Win64偱傕AfxBin_Compress_*(),AfxBin_Expand()偼枹懳墳偵偟傑偟偨丅偙傟傜偺娭悢偼億僀儞僞偑32價僢僩偱偁傞帠偵嫮偔埶懚偟偰偍傝丄64價僢僩娐嫬偱傕摦嶌偡傞傛偆偵曄峏偡傞帠偑崲擄偩偐傜偱偡丅偙傟傜偺娭悢偼32價僢僩娐嫬偱嶌惉偟偨僣乕儖偱偟偐巊梡偟側偄偺偱丄64價僢僩娐嫬偱巊偊側偔偰傕栤戣桳傝傑偣傫丅
#ifdef  USE_AFXBIN_COMPRESS
//劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒
//仭MkAfxSeqXml.jsx偑弌椡偟偨XML宍幃偺傾僯儊乕僔儑儞僼傽僀儖(暋悢壜)傪撉傒崬傒丄(暋悢側傜偽)摑崌偟偰丄僶僀僫儕宍幃偺傾僯儊乕僔儑儞僼傽僀儖偵曐懚偡傞丅
//劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒
/****************************************************************************
 *	僌儘乕僶儖娭悢
 ****************************************************************************/
void AfxBin_Compress_l(const char* binPath/*NULL壜*/, const char* enmPath/*NULL壜*/, ...);			//堷悢=(binPath,enmPath,xmlPath,xmlPath,...,xmlPath,NULL)丅嵟彫偼(binPath,enmPath,NULL)偱傕椙偄(柍堄枴偩偑)丅
void AfxBin_Compress_a(const char* binPath/*NULL壜*/, const char* enmPath/*NULL壜*/, va_list ap);		//ap={xmlPath,xmlPath,...,xmlPath,NULL}丅嵟彫偼ap={NULL}偱傕椙偄(柍堄枴偩偑)丅
void AfxBin_Compress_v(const char* binPath/*NULL壜*/, const char* enmPath/*NULL壜*/, const char* aXmlPath[]);	//aXmlPath={xmlPath,xmlPath,...,xmlPath,NULL}丅嵟彫偼aXmlPath={NULL}偱傕椙偄(柍堄枴偩偑)丅
/****************************************************************************
 *	巊梡椺
 ****************************************************************************/
#if 0
//XML宍幃偺傾僯儊乕僔儑儞僼傽僀儖傪摑崌偟偰僶僀僫儕宍幃偺傾僯儊乕僔儑儞僼傽僀儖偵曐懚偡傞偵偼丄亀dpafxbin.exe亁僣乕儖傪巊梡偡傞帠傕弌棃傑偡丅
//傎傏丄埲壓偺巊梡椺偦偺傑傑偺張棟傪幚峴偡傞僣乕儖偱偡丅徻嵶偼丄/clip/tool/dpafxbin/app.c傪嶲徠偟偰壓偝偄丅
/*--------------------------------------------------------------------------*/
void test() {
	AfxBin_Compress_l(
		"AfxBin.bin",		//劍弌椡僼傽僀儖(NULL壜)	僶僀僫儕宍幃偺傾僯儊乕僔儑儞僼傽僀儖
		"EnmAfxBin.txt",	//劊				楍嫇掕媊僗僋儕僾僩
		"sample1.xml",		//劉
		"sample2.xml",		//劌擖椡僼傽僀儖(暋悢壜)	MkAfxSeqXml.jsx偱嶌惉偟偨丄AfterEffects傾僯儊乕僔儑儞僨乕僞僼傽僀儖
		"sample3.xml",		//劊
		NULL);
}
/*--------------------------------------------------------------------------*/
#endif
#endif//USE_AFXBIN_COMPRESS
#ifdef  USE_AFXBIN_EXPAND
//劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒
//仭AfxBin_Compress_*()偑弌椡偟偨僶僀僫儕宍幃偺傾僯儊乕僔儑儞僼傽僀儖傪撉傒崬傒丄儊儌儕忋偵ST_AfxSeq旕埑弅宍幃偺僣儕乕傪嶌惉偡傞丅ST_AfxSeq旕埑弅宍幃偺僣儕乕偼丄clipafxs.c偺娭悢偱埖偊傞丅
//劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒
/****************************************************************************
 *	僌儘乕僶儖娭悢
 ****************************************************************************/
void AfxBin_Expand(const char* path, void (*fnLoad)(ST_AfxSeq* pAfxSeq, void* user_data), int (*fnGetFootage)(const char* fileName, void* user_data), void* user_data);
/****************************************************************************
 *	巊梡椺
 ****************************************************************************/
#if 0
//Windows偱巊梡偡傞応崌偺丄傾僾儕働乕僔儑儞掕媊娭悢偺僒儞僾儖傪帵偟傑偡丅																	//劉
//幚嵺偺傾僾儕働乕僔儑儞偵崌傢偣偰曄峏偟偨傝丄慡偔暿偺張棟偵偟偰傕峔偄傑偣傫丅																	//劆
/*--------------------------------------------------------------------------*/																	//劆
//仩AfxSeq_Load()偵搉偡傾僾儕働乕僔儑儞掕媊娭悢偺僒儞僾儖																			//劆
static void fnLoad(ST_AfxSeq* pAfxSeq, void* user_data) {																			//劆
	ght_hash_table_t* p_ht = (ght_hash_table_t*)user_data;																			//劆
	if(ght_insert(p_ht, pAfxSeq, strlen(pAfxSeq->name) + 1/*nul*/, pAfxSeq->name)) { DIE(); }														//劆
}																										//劆
static int fnGetFootage_compar(const void* key, const void* data) {																		//劆
	const char* fname = (const char*)key;																					//劆
	const char* pName = EnmDef_GetName(pEnmKey, RegKey_SprNo, (int)data);																	//劆
//	return strcasecmp(   fname, pName);	//dTexDefC.exe偵'-n'僆僾僔儑儞傪巜掕偟側偐偭偨応崌	劍偳偪傜偐堦曽傪慖戰偟偰壓偝偄丅									//劆
	return strnatcasecmp(fname, pName);	//dTexDefC.exe偵'-n'僆僾僔儑儞傪巜掕偟偨応崌		劊													//劆
}																										//劆
static int fnGetFootage(const char* fileName, void* user_data) {																		//劆
	//僼僢僥乕僕偺慺嵽僼傽僀儖柤(乣/乣/foobar.png)偐傜丄儀乕僗柤(foobar)偩偗傪庢傝弌偡丅															//劆
	char fname[MAX_FNAME];																							//劆
	splitpath(fileName, NULL, NULL, fname, NULL);																				//劆
	//僗僾儔僀僩偺楍嫇掕媊柤偑丄儀乕僗柤偵堦抳偟偰偄傞偲壖掕偟偰丄僗僾儔僀僩傪専嶕偡傞丅															//劆
	int iSprNo = (int)bsearch(fname, (void*)1, SprNo_Max, 1, fnGetFootage_compar);																//劆
	//           ~~~~~               ~~~~~~~~~~~~~~~~~~~~~~bsearch()傪斣崋偵懳偟偰巊梡偡傞僥僋僯僢僋偱偡丅傾僪儗僗傪斣崋偲尒側偟偰(iSprNo=1乣SprNo_Max)偵懳偟偰専嶕傪峴偄傑偡丅				//劆
	if(!iSprNo) { DIE(); }	//僗僾儔僀僩偑尒偮偐傜側偗傟偽丄僄儔乕掆巭偡傞丅																//劆
	return iSprNo;																								//劌偙偺斖埻偼clipafxs.h偺乽巊梡椺乿偲慡偔摨偠偱偡丅
}																										//劆
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */																	//劆
//仩AfxSeq_Draw()偵巜掕偡傞傾僾儕働乕僔儑儞掕媊娭悢偺僒儞僾儖																			//劆
static void fnDraw(int layerDepth, const char* layerPath[], int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int footage, int sequence, double opacity, int blendingMode, void* user_data) {	//劆
	//僗僾儔僀僩忣曬傪庢摼偡傞丅																						//劆
	ST_SprDef stSprDef;																							//劆
	get_sprDef(footage + sequence, &stSprDef);																				//劆
	//帺桼曄宍僗僾儔僀僩傪昤夋偡傞丅																					//劆
	CbkQue_draw_spr3(pCbkQue,																						//劆
		0,																								//劆
		x1, y1,	//topLeft																						//劆
		x2, y2,	//topRight																						//劆
		x3, y3,	//bottomRight	//劍TriangleFan偺暲傃																			//劆
		x4, y4,	//bottomLeft	//劊																					//劆
		footage + sequence,																						//劆
		D3DRGBA(1.0,1.0,1.0,opacity),																					//劆
		blendingMode ? DX_BLENDMODE_ADD : DX_BLENDMODE_ALPHA);																		//劆
}																										//劆
/*--------------------------------------------------------------------------*/																	//劆
//傾僾儕働乕僔儑儞偐傜偺巊梡椺																							//劆
int cpp_main(int argc, char* argv[]) {																						//劆
	ght_hash_table_t* p_ht = ght_create(0);																					//劆
	ght_set_rehash(p_ht, 1);																						//劊
	AfxBin_Expand("AfxBin1.bin", fnLoad, fnGetFootage, p_ht);	//劉
	AfxBin_Expand("AfxBin2.bin", fnLoad, fnGetFootage, p_ht);	//劌暋悢壜
	AfxBin_Expand("AfxBin3.bin", fnLoad, fnGetFootage, p_ht);	//劊
	{                          /*~~~~~~  ~~~~~~~~~~~~*/
		const char* name = "animation1";																				//劉
		ST_AfxSeq* pAfxSeq = (ST_AfxSeq*)ght_get(p_ht, strlen(name) + 1/*nul*/, name);															//劆
		if(!setjmp(env_exit)) {																						//劆
			for(;;) {																						//劆
				schedule();																					//劆
				ST_AfxMat tmp = AfxMat_1;																			//劆
				AfxMat_Position(&tmp, DISP_X/2, DISP_Y/2);																	//劆
				AfxMat_Rotation(&tmp, now * ((M_PI * 2.0) / SEC(10.0)));															//劆
				AfxMat_Scale(&tmp, 0.75, 0.75);																			//劆
				AfxMat_AnchorPoint(&tmp, 580, 490);																		//劆
				AfxSeq_Draw(pAfxSeq, now, 1, &tmp, 1.0, 0, fnDraw, NULL, NULL);															//劆
			}                                                /*~~~~~~*/																//劌偙偺斖埻偼clipafxs.h偺乽巊梡椺乿偲慡偔摨偠偱偡丅
		}																								//劆
		ght_iterator_t it;																						//劆
		for(pAfxSeq = (ST_AfxSeq*)ght_first(p_ht, &it, (const void**)&name);																//劆
		    pAfxSeq;																							//劆
		    pAfxSeq = (ST_AfxSeq*)ght_next( p_ht, &it, (const void**)&name)) {																//劆
			AfxSeq_Free(pAfxSeq);																					//劆
		}																								//劆
	}																									//劆
	ght_finalize(p_ht);																							//劆
	return EXIT_SUCCESS;																							//劆
}																										//劊
/*--------------------------------------------------------------------------*/
#endif
#endif//USE_AFXBIN_EXPAND
//劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒
//仭AfxBin_Compress_*()偑弌椡偟偨僶僀僫儕宍幃偺傾僯儊乕僔儑儞僼傽僀儖傪撉傒崬傒丄儊儌儕忋偵ST_AfxSeq埑弅宍幃偺僣儕乕傪嶌惉偡傞丅ST_AfxSeq埑弅宍幃偺僣儕乕偼丄AfxBin_Draw()偱昤夋偡傞丅
//劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒劒
#define USE_AFXBIN_DRAW_STATISTICS	//昤夋摑寁忣曬偑晄梫側傜偽偙偺僔儞儃儖掕媊傪僐儊儞僩傾僂僩偟偰偔偩偝偄丅
//{{2016/09/09捛壛:64價僢僩娐嫬偱AfxBin_Draw()傪巊梡弌棃傞傛偆偵偡傞偨傔偵丄32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱偲偟偰ST_AfxBinLyr,ST_AfxBin傪捛壛偟傑偟偨丅
// * Fri Sep 09 21:13:53 JST 2016 Naoyuki Sawa
// - 64價僢僩娐嫬偱AfxBin_Draw()傪巊梡弌棃傞傛偆偵偡傞偨傔偵丄32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱偲偟偰ST_AfxBinLyr,ST_AfxBin傪捛壛偟傑偟偨丅
//   曄峏傪峴偭偨棟桼偼丄埲壓偺捠傝偱偡丅
// - 偙傟傑偱偼丄僶僀僫儕宍幃傪埖偆娭悢偱偼丄ST_AfxLyr,ST_AfxSeq峔憿懱偺億僀儞僞宆僼傿乕儖僪傪惍悢僼傿乕儖僪偲尒側偟偰巊梡偟偰偄傑偟偨丅
//   偙偆側偭偰偄傞棟桼偼昁慠偱偼側偔丄嵟弶偵clipafxs.c傪幚憰偟偨屻偱丄巚偄晅偒偱clipafxb.c傪幚憰偟偨嵺偺惉傝峴偒偱偙偆側偭偰偄偨傕偺偱丄杮摉偼朷傑偟偔偁傝傑偣傫偱偟偨丅
//   朷傑偟偄幚憰曽朄偱偼側偄偺偱偡偑丄32價僢僩斉偱偼摦嶌忋偼栤戣側偐偭偨偺偱丄偦偺傑傑偵偟偰偄傑偟偨丅
// - 偟偐偟丄64價僢僩斉偱偼丄億僀儞僞宆偲惍悢宆偺僒僀僘偑堎側傞偨傔丄亀dpafxbin.exe亁偱嶌惉偟偨僨乕僞傪撉傒崬傫偱巊梡偟傛偆偲偡傞偲丄峔憿懱僒僀僘偑堘偭偰巊梡弌棃側偄栤戣偑惗偠傑偟偨丅
//   偦偺偨傔丄柧帵揑偵僶僀僫儕宍幃傪昞偡峔憿懱傪掕媊偡傞昁梫偑惗偠傑偟偨丅
// - 忋婰偺捠傝丄崱夞偺曄峏偼丄64價僢僩懳墳偺偨傔偵昁梫偲側偭偨傕偺偱偡丅
//   32價僢僩斉偼偙傟傑偱偺傑傑偱傕峔傢側偄偺偱偡偑丄32價僢僩斉偵偍偄偰傕柧帵揑偵僶僀僫儕宍幃傪昞偡峔憿懱傪巊梡偡傞曽偑朷傑偟偄帠偲丄32價僢僩斉偲64價僢僩斉偱僐乕僪傪嫟捠壔偟偨偄偺偱丄32價僢僩斉偵傕崱夞偺曄峏傪揔梡偡傞帠偵偟傑偟偨丅
//   32價僢僩斉偺娤揰偐傜偼丄億僀儞僞宆僼傿乕儖僪傪惍悢偵僉儍僗僩偡傞張棟偑晄梫偵側偭偨偩偗偱偁傝丄撪晹張棟偲偟偰偼曄傢偭偰偄傑偣傫丅
/****************************************************************************
 *	32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱
 ****************************************************************************/
//儗僀儎			AfterEffects忋偺儗僀儎偵憡摉偡傞丅
typedef struct _ST_AfxBinLyr {	//32價僢僩斉偺ST_AfxLyr偵僶僀僫儕儗僀傾僂僩屳姺偱偡丅(32價僢僩斉偱傕64價僢僩斉偱傕)
	int			name;				//+ 0, 4  儗僀儎柤丅																																																										//僶僀僫儕宍幃偱偼丄(ST_AfxBinLyr*)偺愭摢傾僪儗僗偐傜丄暥帤楍僥乕僽儖撪偺儗僀儎柤傊偺僆僼僙僢僩偑奿擺偝傟偰偄傑偡丅
	int			pAfxBin;			//+ 4, 4  巕奒憌偺僐儞億僕僔儑儞丅柍偗傟偽NULL丅																																																						//僶僀僫儕宍幃偱偼丄(ST_AfxBinLyr*)偺愭摢傾僪儗僗偐傜丄(ST_AfxBin*)傊偺僆僼僙僢僩偑奿擺偝傟偰偄傑偡丅
	int			footage;			//+ 8, 4  偙偺儗僀儎偱昤夋偡傞慺嵽偺儀乕僗ID丅(sequenceLength=0)側傜偽(footage=晄掕抣)丅	'<footage><fileName>fileName</fileName>乣</footage>'偺fileName偵懳偟偰丄(*fnGetFootage)()偑曉偟偨抣傪奿擺偟傑偡丅抣偺夝庍偼傾僾儕働乕僔儑儞偺擟堄偱偡丅P/ECE側傜偽TEX_*傗SPR_*丄Windows側傜偽TexNo_*傗SprNo_*傪奿擺偡傞偺偑堦斒揑偩偲巚偄傑偡偑丄偦傟埲奜偺抣傪夝庍偟偰傕峔偄傑偣傫丅														//僶僀僫儕宍幃偱偼丄(ST_AfxBinLyr*)偺愭摢傾僪儗僗偐傜丄暥帤楍僥乕僽儖撪偺慺嵽僼傽僀儖柤傊偺僆僼僙僢僩偑奿擺偝傟偰偄傑偡丅
	unsigned short		sequenceLength;			//+12, 2  僔乕働儞僗偺挿偝丅(sequenceLength=0)側傜偽偙偺儗僀儎偼昤夋柍偟丅			惷巭夋,枖偼,摦夋側傜偽1傪奿擺偟傑偡丅楢斣僔乕働儞僗側傜偽楢斣僔乕働儞僗傪峔惉偡傞惷巭夋偺悢傪奿擺偟傑偡丅偙偺儗僀儎偱昞帵偡傞慺嵽偺ID偼[ST_AfxBinLyr.footage乣ST_AfxBinLyr.footage+(ST_AfxBinLyr.sequenceLength-1)]偲側傝傑偡丅慺嵽偺ID偑柤慜偺徃弴偱,偐偮,暲傃偑曵傟傞傛偆側曄懃揑側柤慜偺晅偗曽傪偟偰偄側偄帠偑慜採偱偡丅AfterEffects偺楢斣僔乕働儞僗傕柤慜弴側偺偱偦傟偵堦抳偝偣傞僀儊乕僕偱偡丅
	unsigned short		blendingMode;			//+14, 2  僽儗儞僪儌乕僪丅									0:NORMAL,1:ADD	崱屻丄AfterEffects忋偺懠偺僽儗儞僪儌乕僪偵傕懳墳偟偨傜丄庢傝摼傞抣傪憹傗偡梊掕偱偡丅AfterEffects僗僋儕僾僩忋偺楍嫇抣(BlendingMode.*)偲丄摨偠抣偱偼側偄帠偵拲堄偟偰壓偝偄丅嵍婰偺楍嫇抣偼拞搑敿抂偵戝偒側側抣(NORMAL=4412側偳)偱丄偦偺傑傑偺抣偱偼巊偄偯傜偄偐傜偱偡丅
	unsigned short		startFrame;			//+16, 2  昞帵婜娫偺奐巒僼儗乕儉斣崋丅
	unsigned short		nFrames;			//+18, 2  昞帵婜娫偺僼儗乕儉悢丅
	ST_AfxFra		frames[0/*nFrames*/];		//+20,32N 僼儗乕儉攝楍丅									僼儗乕儉攝楍偺梫慺悢偑摿偵懡偔側傞偲巚偆偺偱丄梕検嶍尭偺偨傔億僀儞僞攝楍偱側偔抣攝楍偲偟偨丅
} ST_AfxBinLyr;							//=20+32N
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//僔乕働儞僒			AfterEffects忋偺僐儞億僕僔儑儞偵憡摉偡傞丅
typedef struct _ST_AfxBin {	//32價僢僩斉偺ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺偱偡丅(32價僢僩斉偱傕64價僢僩斉偱傕)
	int			name;				//+ 0, 4  僐儞億僕僔儑儞柤丅																																																									//僶僀僫儕宍幃偱偼丄(ST_AfxBin*)偺愭摢傾僪儗僗偐傜丄暥帤楍僥乕僽儖撪偺僐儞億僕僔儑儞柤傊偺僆僼僙僢僩偑奿擺偝傟偰偄傑偡丅
	unsigned short		totalFrame;			//+ 4, 2  嵞惗婜娫偺僼儗乕儉悢丅
	unsigned short		nLayers;			//+ 6, 2  儗僀儎悢丅
	int			layers[0/*nLayers*/];		//+ 8, 4N 儗僀儎偺億僀儞僞攝楍丅																																																								//僶僀僫儕宍幃偱偼丄(ST_AfxBin*)偺愭摢傾僪儗僗偐傜丄(ST_AfxBinLyr*)傊偺僆僼僙僢僩偑奿擺偝傟偰偄傑偡丅
} ST_AfxBin;							//= 8+ 4N
//}}2016/09/09捛壛:64價僢僩娐嫬偱AfxBin_Draw()傪巊梡弌棃傞傛偆偵偡傞偨傔偵丄32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱偲偟偰ST_AfxBinLyr,ST_AfxBin傪捛壛偟傑偟偨丅
/****************************************************************************
 *	僌儘乕僶儖娭悢
 ****************************************************************************/
//{{2016/09/09曄峏:64價僢僩娐嫬偱AfxBin_Draw()傪巊梡弌棃傞傛偆偵偡傞偨傔偵丄32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱偲偟偰ST_AfxBinLyr,ST_AfxBin傪捛壛偟傑偟偨丅
//void AfxBin_Draw(const ST_AfxSeq* pAfxSeq, int iFrame, int bLoop, const ST_AfxMat* pAfxMat, double opacity, int blendingMode,
//                 void (*fnDraw/*NULL壜*/)(int layerDepth, const char* layerPath[], int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, const char* _footage, int sequence, double opacity, int blendingMode, void* user_data),
//                 const ST_AfxSeq* (*fnFilter/*NULL壜*/)(int layerDepth, const char* layerPath[], const ST_AfxSeq* pAfxSeq, void* user_data),
//                 void* user_data);
//伀2016/09/09曄峏:64價僢僩娐嫬偱AfxBin_Draw()傪巊梡弌棃傞傛偆偵偡傞偨傔偵丄32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱偲偟偰ST_AfxBinLyr,ST_AfxBin傪捛壛偟傑偟偨丅
void AfxBin_Draw(const ST_AfxBin* pAfxBin, int iFrame, int bLoop, const ST_AfxMat* pAfxMat, double opacity, int blendingMode,
                 void (*fnDraw/*NULL壜*/)(int layerDepth, const char* layerPath[], int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, const char* _footage, int sequence, double opacity, int blendingMode, void* user_data),
                 const ST_AfxBin* (*fnFilter/*NULL壜*/)(int layerDepth, const char* layerPath[], const ST_AfxBin* pAfxBin, void* user_data),
                 void* user_data);
//}}2016/09/09曄峏:64價僢僩娐嫬偱AfxBin_Draw()傪巊梡弌棃傞傛偆偵偡傞偨傔偵丄32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱偲偟偰ST_AfxBinLyr,ST_AfxBin傪捛壛偟傑偟偨丅
void AfxBin_ClearFrameCache();
#ifdef  USE_AFXBIN_DRAW_STATISTICS
typedef struct _ST_AfxBin_Draw_Statistics {
	unsigned	nCacheHit[(3+1)/*挷惍壜*/];	//[0]=摉奩僼儗乕儉僉儍僢僔儏僸僢僩夞悢,[1]=1僼儗乕儉慜僉儍僢僔儏僸僢僩夞悢,[2]=2僼儗乕儉慜僉儍僢僔儏僸僢僩夞悢,[3]=3僼儗乕儉慜僉儍僢僔儏僸僢僩夞悢
	unsigned	nCacheMiss;			//僉儍僢僔儏儈僗夞悢
} ST_AfxBin_Draw_Statistics;
extern ST_AfxBin_Draw_Statistics st_AfxBin_Draw_Statistics;	//昤夋摑寁忣曬丅傾僾儕働乕僔儑儞偐傜捈愙嶲徠偟偰壓偝偄丅
#endif//USE_AFXBIN_DRAW_STATISTICS
/*--------------------------------------------------------------------------*/
//AfxBin_Draw()偐傜屇傃弌偝傟偨(*fnDraw)()偑丄慺嵽ID傪専嶕偡傞偨傔偵棙梡弌棃傞儐乕僥傿儕僥傿娭悢
typedef struct _ST_AfxBin_Draw_GetFootage_Param {
	uint16_t	_RegKey_SprNo;					//=RegKey_SprNo,枖偼,RegKey_TexNo																																										//劍偙偺斖埻偺僼傿乕儖僪偼傾僾儕働乕僔儑儞偺價儖僪帪偵惷揑偵掕媊壜擻偱偡丅
	int		(*fnNamCmp)(const char* s1, const char* s2);	//=dTexDefC.exe偵'-n'僆僾僔儑儞傪巜掕偟側偐偭偨応崌偼strcasecmp丆dTexDefC.exe偵'-n'僆僾僔儑儞傪巜掕偟偨応崌偼strnatcasecmp偱丄惷揑偵弶婜壔偟偰壓偝偄丅偳偪傜偐傢偐傜側偄応崌偼NULL偺傑傑偵偟偰峔偄傑偣傫丅AfxBin_Draw_GetFootage()偑嵟弶偵屇傃弌偝傟偨帪偵帺摦揑偵敾暿偟偰strcasecmp,枖偼,strnatcasecmp傪奿擺偟傑偡丅徻嵶偼AfxBin_Draw_GetFootage()偺幚憰傪嶲徠偟偰壓偝偄丅	//劊
	const void*	pEnmKey;					//=REG_open_key(TBL_RegTbl,RegKey_EnmDef)																																									//劅偙傟偩偗偼傾僾儕働乕僔儑儞偺幚峴奐巒屻偵摦揑偵愝掕偡傞昁梫偑桳傝傑偡丅
} ST_AfxBin_Draw_GetFootage_Param;
int AfxBin_Draw_GetFootage(const char* fileName, ST_AfxBin_Draw_GetFootage_Param* param);
/****************************************************************************
 *	dpafxbin.exe偑弌椡偟偨僶僀僫儕宍幃傪埖偆偨傔偺儐乕僥傿儕僥傿娭悢
 ****************************************************************************/
#define USE_AFXSEQ_BIN	//儐乕僥傿儕僥傿娭悢偑晄梫側傜偽偙偺僔儞儃儖掕媊傪僐儊儞僩傾僂僩偟偰偔偩偝偄丅
#ifdef  USE_AFXSEQ_BIN
//{{2016/09/09曄峏:64價僢僩娐嫬偱AfxBin_Draw()傪巊梡弌棃傞傛偆偵偡傞偨傔偵丄32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱偲偟偰ST_AfxBinLyr,ST_AfxBin傪捛壛偟傑偟偨丅
//const ST_AfxSeq* AfxBin_GetNo(const void* pAfxSeqBin, int iAfxSeqNo);
//void AfxBin_DrawNo(const void* pAfxSeqBin, int iAfxSeqNo, int iFrame, int bLoop, const ST_AfxMat* pAfxMat, double opacity, int blendingMode,
//                   void (*fnDraw/*NULL壜*/)(int layerDepth, const char* layerPath[], int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, const char* _footage, int sequence, double opacity, int blendingMode, void* user_data),
//                   const ST_AfxSeq* (*fnFilter/*NULL壜*/)(int layerDepth, const char* layerPath[], const ST_AfxSeq* pAfxSeq, void* user_data),
//                   void* user_data);
//伀2016/09/09曄峏:64價僢僩娐嫬偱AfxBin_Draw()傪巊梡弌棃傞傛偆偵偡傞偨傔偵丄32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱偲偟偰ST_AfxBinLyr,ST_AfxBin傪捛壛偟傑偟偨丅
const ST_AfxBin* AfxBin_GetNo(const void* pAfxSeqBin, int iAfxSeqNo);
void AfxBin_DrawNo(const void* pAfxSeqBin, int iAfxSeqNo, int iFrame, int bLoop, const ST_AfxMat* pAfxMat, double opacity, int blendingMode,
                   void (*fnDraw/*NULL壜*/)(int layerDepth, const char* layerPath[], int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, const char* _footage, int sequence, double opacity, int blendingMode, void* user_data),
                   const ST_AfxBin* (*fnFilter/*NULL壜*/)(int layerDepth, const char* layerPath[], const ST_AfxBin* pAfxBin, void* user_data),
                   void* user_data);
//}}2016/09/09曄峏:64價僢僩娐嫬偱AfxBin_Draw()傪巊梡弌棃傞傛偆偵偡傞偨傔偵丄32價僢僩斉偺ST_AfxLyr,ST_AfxSeq偵僶僀僫儕儗僀傾僂僩屳姺側峔憿懱偲偟偰ST_AfxBinLyr,ST_AfxBin傪捛壛偟傑偟偨丅
#ifdef  USE_AFXBIN_DUMP
void AfxBin_Dump(FILE* fp, const void* pAfxSeqBin);
#endif//USE_AFXBIN_DUMP
#endif//USE_AFXSEQ_BIN
/****************************************************************************
 *	巊梡椺
 ****************************************************************************/
#if 0
//Windows偱巊梡偡傞応崌偺丄傾僾儕働乕僔儑儞掕媊娭悢偺僒儞僾儖傪帵偟傑偡丅
//幚嵺偺傾僾儕働乕僔儑儞偵崌傢偣偰曄峏偟偨傝丄慡偔暿偺張棟偵偟偰傕峔偄傑偣傫丅
/*--------------------------------------------------------------------------*/
//仩AfxSeq_Draw()偵巜掕偡傞傾僾儕働乕僔儑儞掕媊娭悢偺僒儞僾儖
static void fnDraw(int layerDepth, const char* layerPath[], int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, const char* _footage, int sequence, double opacity, int blendingMode, void* user_data) {
	static ST_AfxBin_Draw_GetFootage_Param param={	/* 俽俿俙俿俬俠偱偡両 */
		RegKey_SprNo,	//僥僋僗僠儍傪巊偭偰昤夋偡傞応崌偼RegKey_TexNo偵曄偊偰壓偝偄丅
	};
	if(!param.pEnmKey) { if(!pEnmKey) { DIE(); } param.pEnmKey = pEnmKey; }	//弶夞偵摉娭悢偑屇傃弌偝傟偨帪偵pEnmKey僼傿乕儖僪傪奿擺偡傞丅僌儘乕僶儖曄悢pEnmKey偵'pEnmKey=REG_open_key(TBL_RegTbl,RegKey_EnmDef)'偑奿擺嵪傒偲憐掕偟傑偡丅
	//慺嵽偺儀乕僗ID傪庢摼偡傞丅
	int footage = AfxBin_Draw_GetFootage(_footage, &param);	//儐乕僥傿儕僥傿娭悢傪棙梡偡傞丅枖偼傾僾儕働乕僔儑儞偑懠偺曽朄偱専嶕偟偰傕峔偄傑偣傫丅
	//僗僾儔僀僩忣曬傪庢摼偡傞丅																						//劉
	ST_SprDef stSprDef;																							//劆
	get_sprDef(footage + sequence, &stSprDef);																				//劆
	//帺桼曄宍僗僾儔僀僩傪昤夋偡傞丅																					//劆
	CbkQue_draw_spr3(pCbkQue,																						//劆
		0,																								//劆
		x1, y1,	//topLeft																						//劌偙偺斖埻偼clipafxs.h偺乽巊梡椺乿偲慡偔摨偠偱偡丅
		x2, y2,	//topRight																						//劆
		x3, y3,	//bottomRight	//劍TriangleFan偺暲傃																			//劆
		x4, y4,	//bottomLeft	//劊																					//劆
		footage + sequence,																						//劆
		D3DRGBA(1.0,1.0,1.0,opacity),																					//劆
		blendingMode ? DX_BLENDMODE_ADD : DX_BLENDMODE_ALPHA);																		//劆
}																										//劊
/*--------------------------------------------------------------------------*/
//傾僾儕働乕僔儑儞偐傜偺巊梡椺
int cpp_main(int argc, char* argv[]) {
	void* buf;
	{
		FILE* fp;
		int size;
		fp = fopen("AfxBin.bin", "rb");	//僶僀僫儕宍幃
		if(!fp) { DIE(); }
		if(fseek(fp, 0, SEEK_END)) { DIE(); }
		if((size = ftell(fp)) < 0) { DIE(); }
		rewind(fp);
		buf = malloc(size);
		if(!buf) { DIE(); }
		if((int)fread(buf, 1, size, fp) != size) { DIE(); }
		fclose(fp);
	}
	if(!setjmp(env_exit)) {																							//劉
		for(;;) {																							//劆
			schedule();																						//劆
			ST_AfxMat tmp = AfxMat_1;																				//劌偙偺斖埻偼clipafxs.h偺乽巊梡椺乿偲慡偔摨偠偱偡丅
			AfxMat_Position(&tmp, DISP_X/2, DISP_Y/2);																		//劆
			AfxMat_Rotation(&tmp, now * ((M_PI * 2.0) / SEC(10.0)));																//劆
			AfxMat_Scale(&tmp, 0.75, 0.75);																				//劆
			AfxMat_AnchorPoint(&tmp, 580, 490);																			//劊
			AfxBin_DrawNo(buf, 1/*AfxSeq_ANIMATION1*/, now, 1, &tmp, 1.0, 0, fnDraw, NULL, NULL);
		}                                                                      /*~~~~~~*/
	}
#ifdef  USE_AFXBIN_DRAW_STATISTICS
	printf("摉奩僼儗乕儉僉儍僢僔儏僸僢僩夞悢: %u\n", st_AfxBin_Draw_Statistics.nCacheHit[0]);	//僗僥僀傪懡梡偡傞偲偙偺抣偑憹偊傑偡丅
	printf("侾僼儗乕儉慜僉儍僢僔儏僸僢僩夞悢: %u\n", st_AfxBin_Draw_Statistics.nCacheHit[1]);	//1攞懍嵞惗傪懡梡偡傞偲偙偺抣偑憹偊傑偡丅
	printf("俀僼儗乕儉慜僉儍僢僔儏僸僢僩夞悢: %u\n", st_AfxBin_Draw_Statistics.nCacheHit[2]);	//2攞懍嵞惗傪懡梡偡傞偲偙偺抣偑憹偊傑偡丅
	printf("俁僼儗乕儉慜僉儍僢僔儏僸僢僩夞悢: %u\n", st_AfxBin_Draw_Statistics.nCacheHit[3]);	//3攞懍嵞惗傪懡梡偡傞偲偙偺抣偑憹偊傑偡丅
	printf("僉儍僢僔儏儈僗夞悢:               %u\n", st_AfxBin_Draw_Statistics.nCacheMiss  );	//偦傟埲奜傪懡梡偡傞偐,枖偼,摨帪嵞惗偡傞傾僯儊乕僔儑儞偑懡夁偓傞偲偙偺抣偑憹偊傑偡丅屻幰偺応崌偼clipafxb.c偺CACHE_TABLE_SIZE,CACHE_BUCKET_LIMIT傪挷惍偟偰壓偝偄丅
#endif//USE_AFXBIN_DRAW_STATISTICS
	free(buf);
	AfxBin_ClearFrameCache();
	return EXIT_SUCCESS;
}
/*--------------------------------------------------------------------------*/
#endif
#ifdef  __cplusplus
}//extern "C"
#endif//__cplusplus
#endif//__CLIP_AFXB_H__
